Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Close interpretergroup session if interpreter process crashed
Browse files Browse the repository at this point in the history
Reamer committed Oct 10, 2024
1 parent bdf5b06 commit fc840dd
Showing 3 changed files with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1141,6 +1141,8 @@ public void testFailtoLaunchSpark() throws IOException {
// "Actual error message: " + p1.getReturn().message().get(0).getData());

// run it again, and get the same error
note.run(p.getId(), true);
assertEquals(Status.FINISHED, p.getStatus());
note.run(p1.getId(), true);
assertEquals(Status.ERROR, p1.getStatus());
// depends on JVM language
Original file line number Diff line number Diff line change
@@ -460,6 +460,14 @@ public ManagedInterpreterGroup getOrCreateInterpreterGroup(ExecutionContext exec
groupId, executionContext);
ManagedInterpreterGroup intpGroup = createInterpreterGroup(groupId);
interpreterGroups.put(groupId, intpGroup);
} else {
// Check for a crashed interpreter process and restart interpreterGroup in this case
ManagedInterpreterGroup interpreterGroup = interpreterGroups.get(groupId);
if (interpreterGroup.isInterpreterProcessCrashed()) {
interpreterGroup.close();
interpreterGroups.remove(interpreterGroup.getId());
return getOrCreateInterpreterGroup(executionContext);
}
}
return interpreterGroups.get(groupId);
} finally {
Original file line number Diff line number Diff line change
@@ -60,6 +60,15 @@ public InterpreterSetting getInterpreterSetting() {
return interpreterSetting;
}

public boolean isInterpreterProcessCrashed() {
if (remoteInterpreterProcess == null) {
return false;
}
synchronized (interpreterProcessCreationLock) {
return !remoteInterpreterProcess.isRunning();
}
}

public RemoteInterpreterProcess getOrCreateInterpreterProcess(String userName,
Properties properties)
throws IOException {

0 comments on commit fc840dd

Please sign in to comment.