Skip to content

Commit

Permalink
Do not run visualizations on InterruptException
Browse files Browse the repository at this point in the history
There is no point in running visualization for the expression value that
is InterruptedException. The latter is likely to bubble up the exception
or create one that will be confusing to the user.

Closes #11243 and partially addresses some of the symptomes of #11084.
  • Loading branch information
hubertp committed Oct 3, 2024
1 parent ad53c82 commit 2b10a3e
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@ public static String findExceptionMessage(Throwable ex) {
}
}

public static boolean isInterruptedExceptionValue(Object object) {
if (object instanceof Throwable ex) {
return isInterruptedException(ex);
} else {
return false;
}
}

public static boolean isInterruptedException(Throwable ex) {
var iop = InteropLibrary.getUncached();
return isInterruptedException(ex, iop);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ final class JobExecutionEngine(
logger.log(
Level.FINE,
"Aborting {0} jobs because {1}: {2}",
Array(cancellableJobs.length, reason, cancellableJobs.map(_.id))
Array[Any](cancellableJobs.length, reason, cancellableJobs.map(_.id))
)
cancellableJobs.foreach { runningJob =>
runningJob.future.cancel(runningJob.job.mayInterruptIfRunning)
Expand All @@ -215,7 +215,7 @@ final class JobExecutionEngine(
logger.log(
Level.FINE,
"Aborting job {0} because {1}",
Array(runningJob.id, reason)
Array[AnyRef](runningJob.id, reason)
)
runningJob.future.cancel(runningJob.job.mayInterruptIfRunning)
}
Expand All @@ -237,7 +237,7 @@ final class JobExecutionEngine(
logger.log(
Level.FINE,
"Aborting job {0} because {1}",
Array(runningJob.id, reason)
Array[Any](runningJob.id, reason)
)
runningJob.future.cancel(runningJob.job.mayInterruptIfRunning)
}
Expand All @@ -260,7 +260,7 @@ final class JobExecutionEngine(
logger.log(
Level.FINE,
"Aborting {0} background jobs because {1}: {2}",
Array(cancellableJobs.length, reason, cancellableJobs.map(_.id))
Array[Any](cancellableJobs.length, reason, cancellableJobs.map(_.id))
)
cancellableJobs.foreach { runningJob =>
runningJob.future.cancel(runningJob.job.mayInterruptIfRunning)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ class ReentrantLocking(logger: TruffleLogger) extends Locking {
contextLock.lock,
"context lock",
where
) //acquireContextLock(contextId)
)
callable.call()
} catch {
case _: InterruptedException =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ object ProgramExecutionSupport {
} else {
runtimeCache.getAnyValue(visualization.expressionId)
}
if (v != null) {
if (v != null && !VisualizationResult.isInterruptedExceptionValue(v)) {
executeAndSendVisualizationUpdate(
contextId,
runtimeCache,
Expand Down

0 comments on commit 2b10a3e

Please sign in to comment.