-
Notifications
You must be signed in to change notification settings - Fork 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
Avoid interrupting jetty threads #10987
Avoid interrupting jetty threads #10987
Conversation
f87eead
to
507e200
Compare
Nit: |
Driver methods such as Driver#updateSplitAssignment can be ran from a thread other than a thread created by TaskExecutor. Interrupting a thread that is not managed by the engine is potentially unsafe. For example the Jetty server may preserve the "interrupted" flag in between requests, potentially impacting a different task or a query: jetty/jetty.project#7548 While the issue in Jetty is likely a bug that will be fixed there is no real reason why to interrupt a method other than Driver#process (which is only invoked by the TaskExecutor). Other driver methods (such as Driver#updateSplitAssignment) are lightweight and shouldn't take any significant time to finish while the interrupt mechanism is rather intended to terminate a processing that could potentially take a significant amount of time.
507e200
to
5ded6b1
Compare
@dain PTAL - it is your area. |
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.
nit: is it possible to write a test?
} | ||
|
||
// Note: task cannot return null | ||
private <T> Optional<T> tryWithLock(long timeout, TimeUnit unit, Supplier<T> task) |
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.
nit: keep this method maybe so that you don't have to add true
argument for existing tryWithLock
invodations
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.
Since this is a private method I wasn't sure if it is worth adding extra overloads (as then you have to document them as well :-))
Testing interrupt is usually painful. I don't think we have a test for the existing interruption logic. |
Description
Driver methods such as Driver#updateSplitAssignment can be ran from a
thread other than a thread created by TaskExecutor. Interrupting a
thread that is not managed by the engine is potentially unsafe.
For example the Jetty server may preserve the "interrupted" flag in between
requests, potentially impacting a different task or a query:
jetty/jetty.project#7548
While the issue in Jetty is likely a bug that will be fixed there is no
real reason why to interrupt a method other than Driver#process (which
is only invoked by the TaskExecutor).
Other driver methods (such as Driver#updateSplitAssignment) are
lightweight and shouldn't take any significant time to finish while the
interrupt mechanism is rather intended to terminate a processing
that could potentially take a significant amount of time.
General information
Fixes #10773
Direct link to a comment describing the problem: #10773 (comment)
Related issues, pull requests, and links
jetty/jetty.project#7548
Documentation
No documentation is needed.
Release notes
No release notes entries required.