Commit 1ba5c072 authored by Fabien Viale's avatar Fabien Viale
Browse files

Stop the scheduler only in case of jython deadlocks

It has been observed recently that shutdown of the scheduler server occurs in case of server lag, not due to python deadlocks. The goal of this change is to trigger a shutdown only when the cause is due to jython and not something else.
parent f02fd3a6
......@@ -38,6 +38,7 @@ import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import org.apache.log4j.Logger;
import org.objectweb.proactive.utils.StackTraceUtil;
public class AllObjects2BytesConverterHandler {
......@@ -53,9 +54,9 @@ public class AllObjects2BytesConverterHandler {
private final static Long deserializationThreshold = Long.getLong(DESERIALIZATION_THRESHOLD, 1000000L);
private final static String ERROR_MESSAGE = " was stuck for more than " + secondsToWait +
" seconds. Killing the Java process.(You can control this timeout with the java property -D" +
" seconds and the thread analysis detected a jython deadlock (see Killing the Java process as the deadlock cannot be recovered (You can control this timeout with the java property -D" +
"= when starting nodes and/or when starting the scheduler )";
"= when starting nodes and/or when starting the scheduler).";
private AllObjects2BytesConverterHandler() {
......@@ -93,6 +94,7 @@ public class AllObjects2BytesConverterHandler {
ExecutorService executor = Executors.newSingleThreadExecutor();
Future<Map<K, V>> future = executor.submit(callable);
try {
try {
if (totalSize < deserializationThreshold) {
// If the amount of bytes to deserialize is small, the deserialization should not exceed a timeout,
......@@ -103,8 +105,14 @@ public class AllObjects2BytesConverterHandler {
resultMap = future.get();
} catch (TimeoutException e) {
if (StackTraceUtil.getAllStackTraces().contains("org.python.core")) {
// We analyse the current thread state to detect jython deadlocks
// see
logger.fatal(action + ERROR_MESSAGE);
resultMap = future.get();
} catch (InterruptedException e) {
throw new RuntimeException(e);
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment