-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
ThreadError can't create Thread: Resource temporarily unavailable #4353
Comments
Could you remove all |
I went ahead and removed the |
It looks like, as in #3217, the problem is that the thread pool is still hard-coded to 25 threads. PR rubygems/bundler#6617 was opened to resolve it, but not merged with the following reasoning:
When Bundler was merged into the RubyGems repository, that became PR #3434, but it was never updated to address the original problem brought up by @colby-swandale. I'm not sure how to fix it in a better way than the original PR proposed, aside from using the more typical Bundler-y way to handle environment variables. It seems like the thread pool is preventing Bundler from being able to create more threads later, and I'm not sure that's a problem we can predict. It might make sense to just let users override it and inform them of how. |
I don't think an ENV variable is an appropriate fix either. Users would have to know that they need to tweak this environment variable when this error happens, and that's quite unlikely to happen. From reading rubygems/bundler#4367, I understand to this error can be raised by ruby when lacking memory or exhausting resource limits. Since this can always potentially happen, I guess we need to handle the error gracefully and stop creating more threads. |
I apologize for the late reply and consequently not cleaning up the bug report. |
@dbelloGitHub thank you for the extra information. Looking at rubygems/bundler#4367, the original commenter and a few other people confirmed this exists on shared hosting. It looks like at this point 6 people have confirmed it exists on multiple shared hosting providers. I dug into the code involved in the backtraces people have provided, and found a complication with trying to handle the error gracefully. Sometimes the problem originates from Bundler directly spawning a new thread. But in other instances, like the backtrace @dbelloGitHub provided above, Bundler may already done spawning all of its threads. The problem in this case was caused by And by that point, we've spawned all of the Bundler threads. So we'd have to clean up the entire
The number of workers (for everything except Rubinius) is 25, and there is the parent process, so there is 51 threads minimum when using |
Thanks for looking into that @duckinator. Hopefully the extra thread in In any case, this seems like unnecessarily high number to me. We could run some performance tests with gemfiles of different sizes over a cold compact index cache to make sure the performance doesn't regress, and reduce this number. We could, for example, make it match |
Same problem as Issue 3217 while creating a new site with Jekyll.
To fix, I was intent to clear all Ruby Apps from CPanel and Setup new App from scratch, entering to virtual environment from Terminal
then
no problem
Then, this command not run completely:
nor
Then create a site, but with this error:
--- ERROR REPORT TEMPLATE -------------------------------------------------------
Error Report
Questions
Please fill out answers to these questions, it'll help us figure out
why things are going wrong.
I ran the command
/h/myuser/rubyvenv/rubyApps/2.6/gems/bundler-2.2.8/exe/bundle install
I expected Bundler to...
Instead, what happened was...
I tried...
...
Backtrace
Environment
Bundler Build Metadata
Gemfile
Gemfile
Gemfile.lock
--- TEMPLATE END ----------------------------------------------------------------
The text was updated successfully, but these errors were encountered: