Skip to content

Commit

Permalink
IGNITE-13832 Proper handling of interrupted exceptions in disco-notif…
Browse files Browse the repository at this point in the history
…ier-worker. - Fixes #8561.

Signed-off-by: Sergey Chugunov <sergey.chugunov@gmail.com>
  • Loading branch information
ibessonov authored and sergey-chugunov-1985 committed Dec 11, 2020
1 parent 0fa783a commit f48f31e
Showing 1 changed file with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference;

import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteClientDisconnectedException;
import org.apache.ignite.IgniteException;
Expand Down Expand Up @@ -101,6 +100,7 @@
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.P1;
import org.apache.ignite.internal.util.typedef.T2;
import org.apache.ignite.internal.util.typedef.X;
import org.apache.ignite.internal.util.typedef.internal.CU;
import org.apache.ignite.internal.util.typedef.internal.LT;
import org.apache.ignite.internal.util.typedef.internal.S;
Expand Down Expand Up @@ -2740,18 +2740,19 @@ public synchronized void submit(GridFutureAdapter notificationFut, Runnable cmd)
try {
body0();
}
catch (InterruptedException e) {
if (!isCancelled)
ctx.failure().process(new FailureContext(SYSTEM_WORKER_TERMINATION, e));

throw e;
}
catch (Throwable t) {
U.error(log, "Exception in discovery notyfier worker thread.", t);
boolean isInterruptedException = X.hasCause(t, InterruptedException.class)
|| X.hasCause(t, IgniteInterruptedException.class)
|| X.hasCause(t, IgniteInterruptedCheckedException.class);

FailureType type = t instanceof OutOfMemoryError ? CRITICAL_ERROR : SYSTEM_WORKER_TERMINATION;
if (!isInterruptedException)
U.error(log, "Exception in discovery notifier worker thread.", t);

ctx.failure().process(new FailureContext(type, t));
if (!isInterruptedException || !isCancelled) {
FailureType type = t instanceof OutOfMemoryError ? CRITICAL_ERROR : SYSTEM_WORKER_TERMINATION;

ctx.failure().process(new FailureContext(type, t));
}

throw t;
}
Expand Down

0 comments on commit f48f31e

Please sign in to comment.