-
Notifications
You must be signed in to change notification settings - Fork 62
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
Clean shutdown procedure is not invoked when the main thread participates in thread pool execution #123
Comments
Thanks for opening the ticket. We will take a look and get back to you! |
Thanks for submitting this - good catch. I've had a TODO in the code for awhile to fix the use of |
One more issue with main thread acting as an additional worker — it needs additional connection to the pooled resources over chosen thread count. For example with explicitly chosen 10 worker threads, the database connection pool would have to be 10 + 1 in order to not experience This is not immediately obvious until experiencing it and reading the code. |
Yeah this is a good point as well. I had always intended to revisit the use of |
Concurrent::ThreadPoolExecutor
is initialized withfallback_policy: :caller_runs
This means that the work will be executed in the thread of the caller, instead of being given to another thread in the pool when the queue of waiting work has reached the maximum size (backpressure) and no new threads can be created.
In such case all the exceptions are rescued in the
RubyThreadPoolExecutor#run_task
.This means that
Aws::Rails::SqsActiveJob#run
rescue block is not triggered and clean shutdown procedure is not invoked.The text was updated successfully, but these errors were encountered: