Skip to content

Conversation

@drdrsh
Copy link
Collaborator

@drdrsh drdrsh commented Sep 16, 2022

One common gotcha when using Pgbouncer is setting the limit of open file descriptions (ulimit -n) too low. This problem will manifest when the number of open connections reaches that limit, the proxy will stop accepting connections after that point, needless to say this is the worst time for this problem to manifest because the system is already under load.

In this PR, we have Pgcat check the limit at startup and exit if it is set too low.

@drdrsh drdrsh changed the title Mostafa ulimit check pgcat Check ulimit -n before starting up Sep 16, 2022
@drdrsh drdrsh marked this pull request as ready for review September 16, 2022 01:42
match Command::new("ulimit").arg("-n").output().await {
Ok(output) => {
let result = String::from_utf8_lossy(&output.stdout);
match result.trim_end().parse::<i64>() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try unwrap_or_else.

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

Successfully merging this pull request may close these issues.

2 participants