-
Notifications
You must be signed in to change notification settings - Fork 28.5k
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
[SPARK-23785][LAUNCHER] LauncherBackend doesn't check state of connection before setting state #20893
Conversation
…tion before setting state
@@ -114,10 +114,10 @@ private[spark] abstract class LauncherBackend { | |||
|
|||
override def close(): Unit = { | |||
try { | |||
_isConnected = false | |||
super.close() | |||
} finally { | |||
onDisconnected() |
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 searched the code and seems this is a no-op?
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.
_isConnected
is used in def isConnected()
. Moving it from the finally
block to before the call to super.close()
avoids a race condition where a client tries to write to the connection after it has been closed.
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 know your meaning, but I'm not referring to isConnected
, I mean onDisconnected
seems not doing anything on Spark side.
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.
This is not quite directly related, but this should means it is safe to move _isConnected = false
to before onDisconnected()
.
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.
Yeah, your right, it doesn't look like onDisconnected
is being used anywhere, but its marked as protected
so I guess its meant to be used by a sub-class (although no sub-class uses it).
So agree, this change should be safe, it doesn't change the semantics of any use of onDisconnected
The change looks good, cc @cloud-fan |
Jenkins, ok to test |
Test build #88577 has finished for PR 20893 at commit
|
retest this please |
The change looks ok but the test being added is totally unrelated to it. If you want to write a test, it should be not too hard to add something to |
Ok, I'll work on writing a test for The test added here was meant to cover the race condition mentioned here |
Test build #88604 has finished for PR 20893 at commit
|
Wrote a test in
Seems the failures I was seeing in HIVE-18533 are due to something else. Regardless, this is still probably a good fix since you still don't want to write to the connection unless its open, but given that the exception is only logged and not thrown, don't see an easy way to write a test for this. |
SGTM. Jenkins, retest this please. |
retest this please |
Test build #88679 has finished for PR 20893 at commit
|
Merging to master / 2.3. |
…tion before setting state ## What changes were proposed in this pull request? Changed `LauncherBackend` `set` method so that it checks if the connection is open or not before writing to it (uses `isConnected`). ## How was this patch tested? None Author: Sahil Takiar <[email protected]> Closes #20893 from sahilTakiar/master. (cherry picked from commit 491ec11) Signed-off-by: Marcelo Vanzin <[email protected]>
Hi, @vanzin and @sahilTakiar . Could you take a look at branch-2.3 master
|
Let me revert the change from 2.3 and open a bug for the flaky test. |
Thank you so much for swift action, @vanzin ! |
Could we revert the PR from the master brach too? |
Let me revert this PR from the master. Please resubmit the PR after addressing the flaky tests. Thanks! |
The test is fixed by #20950. Just push that one instead. |
I see. Could you merge that PR? |
Sure. Although I'm not sure why other committers who review PRs don't just merge them too... |
…tion before setting state ## What changes were proposed in this pull request? Changed `LauncherBackend` `set` method so that it checks if the connection is open or not before writing to it (uses `isConnected`). ## How was this patch tested? None Author: Sahil Takiar <[email protected]> Closes apache#20893 from sahilTakiar/master.
What changes were proposed in this pull request?
Changed
LauncherBackend
set
method so that it checks if the connection is open or not before writing to it (usesisConnected
).How was this patch tested?
None