-
Notifications
You must be signed in to change notification settings - Fork 87
Add a script to terminate idle pg connections #746
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should be some context, what pg connections are we talking about?
9ed45a7
to
729f75d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm (not 100% sure though, whether that the print()
before commit()
should not be saying "terminating", but that should not have much impact 😉)
Koji keeps opening new connections to the database, and keeps them open up to the point where no new connection can be open. Koji then starts to fail, with a database outage error message. This scripts terminates the connexions older that 10 minutes, and is intended to run every minute on the koji server. Signed-off-by: Gaëtan Lehmann <[email protected]>
729f75d
to
cb277e4
Compare
Yes, that was a weird place to add it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like a temporary workaround, so I'm not entirely at ease with merging this and risking to make it a long lived hack.
Unless that's what the koji developers recommend?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not what koji developers recommend at all. Quoting Mike McLean from :
Koji works on a one connection per thead model. If httpd leaves threads active, then they will keep their db connection.
See discussion in https://pagure.io/koji/issue/4175Issue #4175: Add an limit for the database connections - koji - Pagure.io
Most likely the solution to your issue lies in httpd configuration
That said, it is normal for kojihub to keep a lot of connections open.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is indeed a temporary workaround.
I'm converting this to draft. We probably don't want to spend more time on it unless we can't find a proper fix (and @nathanael-h might already have found one). |
We don't need it anymore 🎉 |
Koji keeps opening new connections to the database, and keeps them open
up to the point where no new connection can be open. Koji then starts
to fail, with a database outage error message.
This scripts terminates the connexions older that 10 minutes, and is
intended to run every minute on the koji server.