Skip to content

implement user client idle timeout#1189

Merged
JelteF merged 12 commits into
pgbouncer:masterfrom
AndrewJackson2020:user_client_idle_timeout
Nov 5, 2024
Merged

implement user client idle timeout#1189
JelteF merged 12 commits into
pgbouncer:masterfrom
AndrewJackson2020:user_client_idle_timeout

Conversation

@AndrewJackson2020
Copy link
Copy Markdown
Contributor

This PR implement a user level version of the client_idle_timeout.

Copy link
Copy Markdown
Member

@JelteF JelteF left a comment

Choose a reason for hiding this comment

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

Overall looks like a fine change. But I'm curious why you need this feature. Also needs a merge conflict resolution.

Comment thread doc/config.md Outdated
Comment thread doc/config.md Outdated

Set the maximum amount of time that a client is allowed to idly connect to
the pgbouncer instance. If set this timeout applies in addition to the
pgbouncer level config described above.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The global setting notes this:

This should be larger than the client-side connection lifetime settings, and only used for network problems.

I guess that's not true for your usecase, otherwise you probably wouldn't need this at the user level. But that does make me curious what your usecase is.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The usecase is that I manage a multi tenant database with users of various levels of trustworthiness. Users who connect via a client connection Pooled application are more trustworthy. Users who connect via psql or pgadmin are less trustworthy. Would like the ability to give untrustworthy users more strict settings around stuff like idle sessions or idle transactions.

Honestly idle sessions are not the biggest deal, especially compared to idle transaction, but I figured I would put together a PR as it is a fairly easy implementation.

Co-authored-by: Jelte Fennema-Nio <github-tech@jeltef.nl>
@AndrewJackson2020
Copy link
Copy Markdown
Contributor Author

One thing about this PR is that it applies in addition to the global level setting. Most of the more granular settings appear to replace the global level settings. I realized this after raising the PR. If you want this can be reworked to act in the same manner.

Comment thread src/janitor.c Outdated
@JelteF JelteF merged commit 544542b into pgbouncer:master Nov 5, 2024
rajaryanece pushed a commit to rajaryanece/pgbouncer that referenced this pull request Jan 16, 2025
This PR implements a user level version of the client_idle_timeout.
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