-
Notifications
You must be signed in to change notification settings - Fork 123
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
Bug 1749510 - RLB: Wait for uploader on shutdown using new shutdown mechanism #2332
Conversation
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.
Nothing that's not surmountable, I think.
280ccab
to
865791b
Compare
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.
r+ conditional on adding a CHANGELOG entry and some instrumentation.
I would prefer to do the instrumentation in a followup. Because of how we upload this is ... not as easy as I would like and so to keep review on point doing that in a followup seems easier. |
Very well, r+ conditional on adding a CHANGELOG entry and filing a follow-up for instrumentation |
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.
👍 Nothing to really add, this looks good! (And +1 on removing the "on" from the function names)
e564ae3
to
649ff48
Compare
On shutdown we now wait up to 30s for the upload thread to finish. This gets done just after we drain and shut down the dispatcher, but before Glean is considered fully shutdown. The callback MUST NOT put any new tasks on the dispatcher. The callback SHOULD NOT block arbitrarily long. The RLB implementation of that callback instructs a potential uploader thread to end operation after it finished one upload. It also blocks any new upload thread from getting started. This means an in-flight upload can finish as usual, but no new one is launched. If the upload thread is currently sleeping, it gets one more upload. This also adds a new test. The only way to reliably test this is from the outside, so the test invokes an example implementation and checks that the `pending_pings` directory is empty after the program ends. The uploader inside sleeps for a short period of time. Without waiting for this uploader the main thread would end and kill the uploader thread before it wakes up. With waiting the uploader finishes correctly before the main thread exits.
649ff48
to
f6a1aeb
Compare
RLB: Wait for uploader on shutdown using new
shutdown
mechanismOn shutdown we now wait up to 30s for the upload thread to finish.
This gets done just after we drain and shut down the dispatcher,
but before Glean is considered fully shutdown.
The callback MUST NOT put any new tasks on the dispatcher.
The callback SHOULD NOT block arbitrarily long.
The RLB implementation of that callback instructs a potential uploader
thread to end operation after it finished one upload.
It also blocks any new upload thread from getting started.
This means an in-flight upload can finish as usual, but no new one
is launched.
If the upload thread is currently sleeping, it gets one more upload.
This also adds a new test.
The only way to reliably test this is from the outside,
so the test invokes an example implementation and checks that the
pending_pings
directory is empty after the program ends.The uploader inside sleeps for a short period of time.
Without waiting for this uploader the main thread would end and kill the
uploader thread before it wakes up.
With waiting the uploader finishes correctly before the main thread
exits.