-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Fix to wakeup threads to quit loop in threads #1264
Fix to wakeup threads to quit loop in threads #1264
Conversation
It's done before returning from stop/after_shutdown, but after setting flag to break while-loop. This change suppresses log messages like 'thread doesn't exit correctly (killed or other reason)' in shutdown sequence.
@repeatedly could you review this change? |
@@ -416,6 +420,12 @@ def before_shutdown | |||
force_flush | |||
end | |||
@buffer.before_shutdown | |||
# Need to ensure to stop enqueueing ... after #shutdown, we cannot write any data | |||
@output_enqueue_thread_running = false | |||
if @output_enqueue_thread && @output_enqueue_thread.alive? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to check status
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to do so. Living threads are running or sleeping.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see
@_threads_mutex.synchronize do | ||
@_threads.each_pair do |obj_id, thread| | ||
@_threads.values.each do |thread| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
each_value
is better for avoding temporary object allocation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed to do so.
super | ||
wakeup_threads = [] | ||
@_threads_mutex.synchronize do | ||
@_threads.values.each do |thread| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
Others are okay for me. |
Okay. I pushed to use |
It's done before returning from stop/after_shutdown, but after setting flag to break while-loop.
This change suppresses log messages like 'thread doesn't exit correctly (killed or other reason)' in shutdown sequence.