-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-14169][Core]Add UninterruptibleThread #11971
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
Conversation
Extract the workaround for HADOOP-10622 introduced by #11940 into UninterruptibleThread so that we can test and reuse it.
|
LGTM but I wonder if just overriding |
|
Test build #54235 has finished for PR 11971 at commit
|
Could you clarify it? If overriding |
|
retest this please |
|
Test build #54250 has finished for PR 11971 at commit
|
|
Yes, my suggestion would make the whole thread uninterruptible. But from the only use case, it seems that would be ok - there are no calls I see that can be interrupted outside of the calls to In any case, not a huge deal. |
| throw new IllegalStateException(s"Call runUninterruptibly in a wrong thread. " + | ||
| s"Expected: $this but was ${Thread.currentThread()}") | ||
| } | ||
|
|
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.
minor: should you bail out early if shouldInterruptThread has already been set somehow?
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.
minor: should you bail out early if shouldInterruptThread has already been set somehow?
Don't get it. shouldInterruptThread is just a flag that indicates if we should call super.interrupt in finally. What do you suggest to do here?
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 mean: if the thread is already interrupted before you try to run the given function (or, in other words, if Thread.interrupt() was called before you get to this point), should you just return early instead of calling the function?
(I guess I should have commented on L68 instead, where there's an explicit check for whether the thread is already interrupted.)
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.
In this case, it should clear the interrupt status and set it back after calling f. StreamExecution allows people to interrupt at any time.
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 understand that's what the code does right now. I'm asking whether it would be better to not run f if the thread has already been interrupted, since you might be running a long computation after some other code has asked the thread to stop what it's doing.
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.
That's a good point. Will update my PR.
|
Test build #54335 has finished for PR 11971 at commit
|
|
LGTM, merging to master. |
What changes were proposed in this pull request?
Extract the workaround for HADOOP-10622 introduced by #11940 into UninterruptibleThread so that we can test and reuse it.
How was this patch tested?
Unit tests