-
Notifications
You must be signed in to change notification settings - Fork 42
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
Error when scaling down - Unable to create thread #59
Comments
I'd suspect a race condition between shutdown and a new job coming in. Perhaps it would be useful to explicitly catch that exception, though I'd like to understand it a bit better first. |
Just experienced this error in production now. Was a few hundred jobs to be processed. Restarted the worker and the same error occurred again after having successfully processed half of the jobs. After processing all jobs it now seems to be stable with new incoming jobs and processing them. |
Maybe you are reaching the machine thread limits.
1.upto(10_000) do |i|
Thread.new { sleep }
puts i
end Example: to heroku 1x worker, it reaches Maybe this could help. |
After more hours on this problem, I discovered that the reason was the |
I think I've found the issue. Server middleware are run per-thread, with a unique instance per thread. So the thread management information isn't shared and it's creating (at least) one monitor per worker. If it's doing unique middleware per job it would be more. |
Nice Justin! |
Is anybody experiencing this reliably enough that you could say if the branch https://github.com/JustinLove/autoscaler/tree/single-thread is a solution? All I've got is a locally modified autoscaler_sample that does 100 jobs per click. |
Justin, I will try it on weekend. |
No feedback, but I think I found a problem. I'll be releasing the above branch soon if there are no objections. |
master updated to single-thread branch and released as 0.12.0 |
WARN: ThreadError: can't create Thread: Resource temporarily unavailable 2015-12-23T15:51:14.908914+00:00 app[worker.1]: 3 TID-owpwn1y0o WARN: /app/vendor/bundle/ruby/2.2.0/gems/autoscaler-0.11.0/lib/autoscaler/sidekiq/thread_server.rb:32:in
initialize'``Occurred when reaching the timeout value and trying to figure out whether to scale down. More jobs to process.
I am unable to replicate this now. I did some other config changes so restarted the dynos a few times. I also noticed that a similar error was logged from the Librato gem. Anyways just wanted to leave this here despite not having more info or unable to replicate at the moment.
The text was updated successfully, but these errors were encountered: