venkata91 commented on a change in pull request #24265: [SPARK-27338][Core] Fix
deadlock in UnsafeExternalSorter.SpillableIterator when locking both
UnsafeExternalSorter.SpillableIterator and TaskMemoryManager
URL: https://github.com/apache/spark/pull/24265#discussion_r271830214
##########
File path:
core/src/main/java/org/apache/spark/util/collection/unsafe/sort/UnsafeExternalSorter.java
##########
@@ -573,19 +573,26 @@ public boolean hasNext() {
@Override
public void loadNext() throws IOException {
- synchronized (this) {
- loaded = true;
- if (nextUpstream != null) {
- // Just consumed the last record from in memory iterator
- if (lastPage != null) {
- freePage(lastPage);
- lastPage = null;
+ MemoryBlock pageToFree = null;
+ try {
+ synchronized (this) {
+ loaded = true;
+ if (nextUpstream != null) {
+ // Just consumed the last record from in memory iterator
+ if(lastPage != null) {
+ pageToFree = lastPage;
Review comment:
Done @cloud-fan . I didn't know that you also filed a PR simultaneously for
the same issue. :)
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]