-
Notifications
You must be signed in to change notification settings - Fork 59
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
Connection leaking in 0.9.0 #110
Comments
Do you have any hints from Are you using both a pgagroal_users.conf file and pgagroal_databases.conf file ? If so, how is the latter configured ? Using In 0.9.x Locally I'm seeing connections being timed out so I'm trying to replicate what you are seeing. Thanks in advance for any additional feedback / information you can provide ! |
Ah yes I wasn't thinking about |
It would be great if you could verify with You can check with |
Could you verify the raw output from |
I'm sorry, the issue was the clients could not get new connections, so I think the metrics were correct. I'll try reproduce locally. |
Here's the python script I use for testing test.txt, ran it several times, tried 1 and 60 for idle_timeout. The first issue I found is Metrics shows both active and total connections consistently went above 60.
I set |
I have added a commit that guards against an active transaction during I'll keep looking based on your feedback - it is interesting that active_connections is much higher than total_connections, and that you are hitting max_connections. Thanks for your test case, and let me know if you find more information to share ! |
For your test case - did you have Their state is shown in the |
You said "connection life-time set to 60s" - what did you mean by that ? |
Yes I left Connection life-time limits the lifetime of a connection in the pool, configured with |
There's another issue I think is related, sometimes 1 pgagroal process would hog 1 entire cpu, I don't have any screenshots but yesterday in my testing I triggered 3 (my testing vm has only 1 cpu, each shows up about 30% cpu usage in htop). |
How many pgagroal processes are active once I'll try and see if I can make a reproducer with hikaricp. |
If you see high CPU for a pgagroal process could you attach gdb to it and create a backtrace ?
Or profile the system using perf to create a flamegraph ? |
about half |
Okay I think I triggered it again with hikaricp, metrics.txt shows pgagroal_active_connections at 111
|
Action connections sometimes goes up to 80 but mostly stays at 0
|
I also run |
okay |
I have fixed the The problem is still |
wait a connection pool could do that? |
Connection pools deal with connection lifecycle, and there are various properties that influences the protocol interaction. |
I have added an assert on the Getting the log
would be good if the assert triggers. |
Maybe try a run with
as well. |
I have added a connection tracker in #114 that will hopefully help to track down this issue further. You can use the
and it will output the needed information. Please, continue your run until you see an issue - either connections timing out, or a mismatch in the statistics. Send me the log via my email. Thanks in advance ! |
I left it run for a few hours, release build on master 56cc3b2
|
Thank you ! This is very helpful :) |
I have fixed an issue dealing with bad file descriptors when the connection is obtained. Any chance you can rerun your test with the latest master branch and attach the log ? |
I went ahead and released 0.9.1 with the issues found so far on this issue. Please, open a new issue if you are still seeing problems with the tracker log. Thanks for your help on this ! |
Describe the bug
Clients couldn't get new connections after upgrading to 0.9.0 , rolling back to 0.8.2 resolves the issue.
All clients utilize connection pooling (either jdbc or libpq based) with pool size of 2~3, connection life-time set to 60s, the number of active connections is very stable.
active_connections:
![Screenshot_2020-09-26T19:10:40+09:00](https://user-images.githubusercontent.com/42634/94338286-91143800-ffe0-11ea-897c-b60d3fb405b6.png)
total_connections:
![Screenshot_2020-09-26T19:15:35+09:00](https://user-images.githubusercontent.com/42634/94338399-5c54b080-ffe1-11ea-96be-2b2321d2667d.png)
To Reproduce
Steps to reproduce the behavior.
Version
What is the version of pgagroal ?
PostgreSQL
What is the version of PostgreSQL ?
12.4-1.pgdg18.04+1
libev
What is the version of libev ?
1:4.22-1
OpenSSL
What is the version of OpenSSL ?
1.1.1-1ubuntu2.1~18.04.6
Access method
Which security access method is used (trust, password, md5, scram-sha-256) ?
md5
OS
Which Operating System (OS) is used ?
ubuntu 18.04
ulimit
What is the output from
ulimit -a
?5000
Configuration
Can you provide the configuration pgagroal ?
Debug logs
Can you provide any debug logs (
log_level = debug5
) of the issue ?Tip
I compiled pgagroal myself, packages are up-to-date
The text was updated successfully, but these errors were encountered: