Skip to content

Commit cce889c

Browse files
committed
Try to kill daemon threads if they cannot be shut down properly
1 parent 9a5139d commit cce889c

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/runtime/PythonContext.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1170,6 +1170,7 @@ private void shutdownThreads() {
11701170
* This method joins all threads created by this context after the GIL was released. This is
11711171
* required by Truffle.
11721172
*/
1173+
@SuppressWarnings("deprecation")
11731174
private void joinThreads() {
11741175
LOGGER.fine("joining threads");
11751176
try {
@@ -1192,10 +1193,15 @@ protected void perform(ThreadLocalAction.Access access) {
11921193
throw new PythonThreadKillException();
11931194
}
11941195
});
1196+
thread.interrupt();
11951197
thread.join(2);
11961198
}
11971199
if (thread.isAlive()) {
1198-
LOGGER.warning("could not join thread " + thread.getName());
1200+
LOGGER.warning("Could not join thread " + thread.getName() + ". Trying to kill it.");
1201+
}
1202+
thread.stop();
1203+
if (thread.isAlive()) {
1204+
LOGGER.warning("Could not kill thread " + thread.getName());
11991205
}
12001206
}
12011207
}

0 commit comments

Comments
 (0)