Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is an explicit disconnect required? #49

Open
hanckmann opened this issue Mar 1, 2021 · 3 comments
Open

Is an explicit disconnect required? #49

hanckmann opened this issue Mar 1, 2021 · 3 comments

Comments

@hanckmann
Copy link

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

@ggregoire
Copy link

I was wondering too but the method disconnect doesn't actually disconnect anything.

@php-coder
Copy link

I have the same question. Any updates on this?

@PeterSanctus
Copy link

PeterSanctus commented Aug 30, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants