-
Notifications
You must be signed in to change notification settings - Fork 4
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
Postgres throws FATAL: sorry, too many clients already
#799
Comments
Now I'm getting some Full (exemplary) log:
|
Options:
|
We decided to go for option 1. @gnn After some reading I tried to adjust the
However, after logging in ( |
@gnn Uh, I was just looking at the wrong place, the solution works out! As you just said, the config file isn't touched by the custom
Also, it is retained during restart! So it might be unnecessary to use another script to set the value. Instead, the line above seems to be sufficient. Or am I overlooking something @gnn? Also, thanks to @Bachibouzouk for your help! |
Yeah, I meant SELECT name, setting, short_desc, vartype, max_val, boot_val, reset_val, pending_restart
FROM pg_settings
WHERE name = 'max_connections'; if you want you want to limit it to "important" stuff and avoid line breaks (at least on my monitor; YMMV). Or |
More generally, implement a function which caches `Engine` objects on a per argument basis and change `engine` to return the same `Engine` for every call from the same process, as determined by process id. Since engines are responsible for managing the connection pool, are supposed to be created once, globally per application, but are also not supposed to be shared across process boundaries, this is the best compromise which hopefully fixes or at least mitigates issue #799.
In motorized individual travel #553 I introduced parallelization in c3542f3 which also leads to parallel DB queries/commits.
As reported via email postgres sometimes throws
FATAL: sorry, too many clients already
. For testing I increased the config parammax_connections
from 100 (default) to 300 and the error now occurs only rarely (and only with many other parallel tasks). Tracking the open connections I see that my tasks use a max. of 4 connections at once. I observed that the connections in my tasks are closed over time, although I don't know how long they stay idle. So with 20 tasks (additional to the other non-emobility running tasks) the limit of 100 is easily exceeded.Shall we increase the
max_connections
or is there a better way of handling connections?The text was updated successfully, but these errors were encountered: