pugsql icon indicating copy to clipboard operation
pugsql copied to clipboard

Is an explicit disconnect required?

Open hanckmann opened this issue 4 years ago • 3 comments

After running a script using pugsql, the following error messages are (always) in my database logs:

2021-01-01T05:50:02.596129Z 177181 [Note] Aborted connection 177181 to db: 'pmx' user: 'devv' host: '127.0.0.1' (Got timeout reading communication packets)
2021-01-01T08:05:02.745313Z 178061 [Note] Aborted connection 178061 to db: 'pmx' user: 'devv' host: '127.0.0.1' (Got timeout reading communication packets)
2021-01-01T10:36:29.269940Z 179043 [Note] Aborted connection 179043 to db: 'pme' user: 'devv' host: '23.143.154.21' (Got timeout reading communication packets)
2021-01-01T10:50:02.680148Z 179134 [Note] Aborted connection 179134 to db: 'pmx' user: 'devv' host: '127.0.0.1' (Got timeout reading communication packets)

This error might occur when a connection is not properly closed. Should i execute explicit disconnects? If yes, than I could not find this in the documentation.

The database in use is MySQL.

Kind regards

hanckmann avatar Mar 01 '21 15:03 hanckmann

I have the same question. Any updates on this?

php-coder avatar Jul 22 '22 04:07 php-coder

I had the same problem, when one queries the DataBase to check active connections, it can be seen that the connections is gathering there, and not really being closed. So I get a lot of problems of too many conns.

What I did was in Module->disconnect, I change the code to dispose the sqlAlchemy engine first:

def disconnect(self):
        """
        Disassociates the module from any connection it was previously given.
        """
        self.engine.engine.dispose()
        self.engine = None
        self._sessionmaker = None

PeterSanctus avatar Aug 30 '22 13:08 PeterSanctus