-
Notifications
You must be signed in to change notification settings - Fork 253
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
ConnectionPool: idle_timeout of 0 causes 100% and busy looping #438
Comments
No help for the underlying issue, but I don't think you would have seen this problem if capistrano weren't loaded in the Sidekiq process. The docs say to use |
To clarify things: We do not load capistrano in sidekiq, only sshkit. We use sshkit directly to manage servers. |
-bump- I'm happy to provide a patch to the problem (outlined in the description above). Is this a viable way to solve this issue? |
Hi @tisba if you can provide a patch it would be most welcome. We are still actively maintaining this library when community patches are provided, but both @mattbrictson and myself are not spending a lot of time on bug fixes ourselves. Please do submit a fix, if you can, and the doc issue:
would be well worth addressing as part of your submission. Thanks indeed. ps. might I ask what's you need for disabling connection pooling all together? (have you deferred control to a controlmaster at the system level? |
We are using sshkit via capistrano, but also stand-alone (mostly) inside sidekiq jobs. We talk to many hosts but most operations are one-off anyway, so there is no real need to pool connections. I don't recall exactly why we tried to disable connection pooling though; not sure if we had "a real issue", not only "we don't need it". Anyway it caused a lot of searching to find out why we kept one core at 100% utilisation and it should be rather simple to fix. I'll try to come up with a patch and we'll see :) 💕 for maintaining sshkit. This gem was really helpful to us! |
I recently noticed that our sidekiq is running at 100% CPU (see sidekiq/sidekiq#3918). We are using sshkit in our sidekiq workers.
We were using:
Which causes a busy loop in
ConnectionPool#run_eviction_loop
as[idle_timeout, 5].min
will be0
:sshkit/lib/sshkit/backends/connection_pool.rb
Lines 131 to 139 in 70d01df
Also, according to
ConnectionPool
s documentation,idle_timeout
can also befalse
ornil
which will actually cause an exception ([nil, 5].min
will raise).I'm happy to propose a fix, but I'd like to have guidance how. My proposal would be to impose a lower limit on
run_eviction_loop
loop frequency like at most once every 5 seconds. On the other hand I don't understand why the eviction loop is required at all if connection caching is disabled (idle_timeout = 0
,ConnectionPool#cache_enabled?
->false
).As far as I can tell the code was heavily changed/rewritten with #328 by @mattbrictson. Maybe he can provide some guidance?
In any case, we can work with increasing the
idle_timeout
to>0
for now. I still like to have this problem fixed though.The text was updated successfully, but these errors were encountered: