-
Notifications
You must be signed in to change notification settings - Fork 68
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
HTTP error: can't move from the enclosed thread group #713
Comments
Same here! Rails 7 / Ruby 3.2.0 def Airbrake.notify(...)
Airbrake.notify_sync(...)
end More info about this workaround |
Hopefully it fixes this issue: airbrake/airbrake-ruby#713
I've been debugging the airbrake-ruby/airbrake code. The problem is that Net:HTTP of ruby starts a timer-thread for add a timeout on the HTTP request that being done. It tries to add the watcher/time thread to the default thread-group, which has been enclosed. ( ThreadGroup::Default.add(watcher) This is the backtrace of the error message: 'can't move from the enclosed thread group'
Looking at this backtrace, it's possible the |
It can be 'solved' when I remove the 'enclose' from the airbrake-gem gem code.
def spawn_workers
@worker_size.times { @workers.add(spawn_worker) }
# @workers.enclose # << When I comment out this, the eclosing issues is gone (of course)
end What happens is the following situation. (Found after debugging)
Why does this happen?
Beste way to solve it?
This commit seems related: ruby/net-http@98caa38 |
I've opened an issue at the Timer repository of Ruby. They mentioned the enclosing support for thread groups is pretty limited. Is it really required for Airbrake to enclose this thread group? |
A better workaround is to call the following method in for example Timeout.ensure_timeout_thread_created This makes sure the Timeout thread is already created and can be moved to the ThreadGroup::Default |
I spent a while banging my head against the wall trying to figure out why this was happening to us in production, but not in development. This might be helpful for others trying to reproduce: Per what @gamecreature has written above, the de facto contract for Coincidentally, as long as you have So, there are two ways to reproduce this issue:
The latter is what made it hard for me to reproduce in development – we had Getting rid of If you need a workaround in cluster-mode Puma, you can call |
IMHO airbrake should not use |
I'm using the default puma configuration generated by Rails 7. Adding |
@phylor the ruby timeout gem solves the issue. (Updating to the latest 0.3.2, fixes the issue) |
@gamecreature That also works, thank you! 🎉 |
Thanks for all the details provided it really made replicating and fixing this one a lot easier. @thompiler and I have removed the usage of |
Hi,
I've this bug, but not specific call of Notify, but in my aribrake.log every 5 second, I've
**Airbrake: HTTP error: can't move from the enclosed thread group
Almost similar of #576
I use the latest airbrake and airbre-ruby gem, with ruby 3.2 ans rails 7.0.4
The text was updated successfully, but these errors were encountered: