Skip to content
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

[CELEBORN-1818] Fix incorrect timeout exception when waiting on no pending writes #3049

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ protected synchronized long close(
}

try {
waitOnNoPending(numPendingWrites);
waitOnNoPending(numPendingWrites, false);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems we no longer need to waitOnNoPending writes, only need waitOnNoPending flushes.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems we no longer need to waitOnNoPending writes, only need waitOnNoPending flushes.

If waitOnNoPending writes is removed, I'm afraid there will be more unnecessary "file already closed" exception and revive operation.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds reasonable, but maybe someone else need to take a look as well.

closed = true;

synchronized (flushLock) {
Expand All @@ -520,7 +520,7 @@ protected synchronized long close(
}

tryClose.run();
waitOnNoPending(notifier.numPendingFlushes);
waitOnNoPending(notifier.numPendingFlushes, true);
} finally {
returnBuffer(false);
try {
Expand Down Expand Up @@ -580,7 +580,7 @@ public void evict(boolean checkClose) throws IOException {
if (memoryFileInfo != null) {
evictInternal();
if (isClosed()) {
waitOnNoPending(notifier.numPendingFlushes);
waitOnNoPending(notifier.numPendingFlushes, true);
storageManager.notifyFileInfoCommitted(shuffleKey, getFile().getName(), diskFileInfo);
}
}
Expand Down Expand Up @@ -634,7 +634,8 @@ public IOException getException() {
}
}

protected void waitOnNoPending(AtomicInteger counter) throws IOException {
protected void waitOnNoPending(AtomicInteger counter, boolean failWhenTimeout)
throws IOException {
long waitTime = writerCloseTimeoutMs;
while (counter.get() > 0 && waitTime > 0) {
try {
Expand All @@ -647,7 +648,7 @@ protected void waitOnNoPending(AtomicInteger counter) throws IOException {
}
waitTime -= WAIT_INTERVAL_MS;
}
if (counter.get() > 0) {
if (counter.get() > 0 && failWhenTimeout) {
IOException ioe = new IOException("Wait pending actions timeout, Counter: " + counter.get());
notifier.setException(ioe);
throw ioe;
Expand Down
Loading