-
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-26265][Core][Followup] Put freePage into a finally block #23294
Conversation
cc @cloud-fan @kiszk |
@cloud-fan do we also need a similar followup for branch-2.4? |
I think this can be merged to 2.4 without conflict. I'll ping you if it doesn't. Thanks! |
LGTM, thanks |
Test build #100002 has finished for PR 23294 at commit
|
retest this please |
Test build #100011 has finished for PR 23294 at commit
|
Test build #100013 has finished for PR 23294 at commit
|
Argh, again!
|
@HyukjinKwon Thanks for letting me know. I will look it and ask CRAN admin for help. |
retest this please. |
@HyukjinKwon I don't find any problem locally. Let me re-trigger the Jenkins test and confirm it. |
Test build #100026 has finished for PR 23294 at commit
|
Sorry, I found out where the problem is. Already asked CRAN admin for help. |
Thanks, @viirya. |
Hey, @viirya, can you send an email to dev mailing list where we're discussing about this, when the tests get back to normal please? |
@HyukjinKwon Ok. But I think we better discuss this on the related JIRA ticket SPARK-24152. |
Yea that sounds more appropriate place to discuss. As a bonus, looks people looks getting confused why it's being failed.. Let's send new email as new thread that the tests became normal as well then. |
retest this please |
retest this please. |
Test build #100061 has finished for PR 23294 at commit
|
all pass |
} | ||
try { | ||
Closeables.close(reader, /* swallowIOException = */ false); |
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.
shall we close the reader outside of the synchronized
block? Then we don't need to extra try catch
.
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 the second try
, it accesses spillWriters
:
reader = spillWriters.getFirst().getReader(serializerManager)
The synchronized
spill
will change spillWriters
. Seems to be unsafe if we close the reader and update reader
like above outside synchronized
?
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.
how about
UnsafeSorterSpillReader readerToClose = null;
synchronized (this) {
...
readerToClose = reader;
reader = spillWriters.getFirst().getReader(serializerManager);
...
}
try {
Closeables.close(readerToClose, /* swallowIOException = */ false);
} catch ...
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'm not sure of the semantics here, but because the close block is changing several fields at once, it seems more conservative to leave them as they are within the synchronized block. At least, that is a separate issue.
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.
@cloud-fan What do you think?
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 think it's okay to go ahead as is
Test build #100074 has finished for PR 23294 at commit
|
Test build #4468 has finished for PR 23294 at commit
|
Test build #4471 has finished for PR 23294 at commit
|
retest this please |
tests were already passed for the same commit at #23294 (comment) Merged to master and branch-2.4. |
## What changes were proposed in this pull request? Based on the [comment](#23272 (comment)), it seems to be better to put `freePage` into a `finally` block. This patch as a follow-up to do so. ## How was this patch tested? Existing tests. Closes #23294 from viirya/SPARK-26265-followup. Authored-by: Liang-Chi Hsieh <viirya@gmail.com> Signed-off-by: Hyukjin Kwon <gurwls223@apache.org> (cherry picked from commit 1b604c1) Signed-off-by: Hyukjin Kwon <gurwls223@apache.org>
Test build #100174 has finished for PR 23294 at commit
|
## What changes were proposed in this pull request? Based on the [comment](apache#23272 (comment)), it seems to be better to put `freePage` into a `finally` block. This patch as a follow-up to do so. ## How was this patch tested? Existing tests. Closes apache#23294 from viirya/SPARK-26265-followup. Authored-by: Liang-Chi Hsieh <viirya@gmail.com> Signed-off-by: Hyukjin Kwon <gurwls223@apache.org>
## What changes were proposed in this pull request? Based on the [comment](apache#23272 (comment)), it seems to be better to put `freePage` into a `finally` block. This patch as a follow-up to do so. ## How was this patch tested? Existing tests. Closes apache#23294 from viirya/SPARK-26265-followup. Authored-by: Liang-Chi Hsieh <viirya@gmail.com> Signed-off-by: Hyukjin Kwon <gurwls223@apache.org>
## What changes were proposed in this pull request? Based on the [comment](apache#23272 (comment)), it seems to be better to put `freePage` into a `finally` block. This patch as a follow-up to do so. ## How was this patch tested? Existing tests. Closes apache#23294 from viirya/SPARK-26265-followup. Authored-by: Liang-Chi Hsieh <viirya@gmail.com> Signed-off-by: Hyukjin Kwon <gurwls223@apache.org> (cherry picked from commit 1b604c1) Signed-off-by: Hyukjin Kwon <gurwls223@apache.org>
## What changes were proposed in this pull request? Based on the [comment](apache#23272 (comment)), it seems to be better to put `freePage` into a `finally` block. This patch as a follow-up to do so. ## How was this patch tested? Existing tests. Closes apache#23294 from viirya/SPARK-26265-followup. Authored-by: Liang-Chi Hsieh <viirya@gmail.com> Signed-off-by: Hyukjin Kwon <gurwls223@apache.org> (cherry picked from commit 1b604c1) Signed-off-by: Hyukjin Kwon <gurwls223@apache.org>
…locking both BytesToBytesMap.MapIterator and TaskMemoryManager In `BytesToBytesMap.MapIterator.advanceToNextPage`, We will first lock this `MapIterator` and then `TaskMemoryManager` when going to free a memory page by calling `freePage`. At the same time, it is possibly that another memory consumer first locks `TaskMemoryManager` and then this `MapIterator` when it acquires memory and causes spilling on this `MapIterator`. So it ends with the `MapIterator` object holds lock to the `MapIterator` object and waits for lock on `TaskMemoryManager`, and the other consumer holds lock to `TaskMemoryManager` and waits for lock on the `MapIterator` object. To avoid deadlock here, this patch proposes to keep reference to the page to free and free it after releasing the lock of `MapIterator`. Added test and manually test by running the test 100 times to make sure there is no deadlock. Closes apache#23272 from viirya/SPARK-26265. Authored-by: Liang-Chi Hsieh <viirya@gmail.com> Signed-off-by: Wenchen Fan <wenchen@databricks.com> (cherry-picked from commit a3bbca9) [SPARK-26265][CORE][FOLLOWUP] Put freePage into a finally block Based on the [comment](apache#23272 (comment)), it seems to be better to put `freePage` into a `finally` block. This patch as a follow-up to do so. Existing tests. Closes apache#23294 from viirya/SPARK-26265-followup. Authored-by: Liang-Chi Hsieh <viirya@gmail.com> Signed-off-by: Hyukjin Kwon <gurwls223@apache.org> (cherry-picked from commit 1b604c1) Ref: LIHADOOP-43221 RB=1518143 BUG=LIHADOOP-43221 G=superfriends-reviewers R=fli,mshen,yezhou,edlu A=fli
What changes were proposed in this pull request?
Based on the comment, it seems to be better to put
freePage
into afinally
block. This patch as a follow-up to do so.How was this patch tested?
Existing tests.