Skip to content

Commit

Permalink
handle crashes gracefully
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosuc3m committed Oct 3, 2024
1 parent 716a622 commit 80bfa36
Showing 1 changed file with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,11 @@ private void launchModelLoadOnProcess() throws IOException, InterruptedException
throw new RuntimeException();
else if (task.status == TaskStatus.FAILED)
throw new RuntimeException();
else if (task.status == TaskStatus.CRASHED)
else if (task.status == TaskStatus.CRASHED) {
this.runner.close();
runner = null;
throw new RuntimeException();
}
}

/**
Expand Down Expand Up @@ -377,8 +380,11 @@ void runInterprocessing(List<Tensor<T>> inputTensors, List<Tensor<R>> outputTens
throw new RuntimeException();
else if (task.status == TaskStatus.FAILED)
throw new RuntimeException();
else if (task.status == TaskStatus.CRASHED)
else if (task.status == TaskStatus.CRASHED) {
this.runner.close();
runner = null;
throw new RuntimeException();
}
for (int i = 0; i < outputTensors.size(); i ++) {
String name = (String) Types.decode(encOuts.get(i)).get(MEM_NAME_KEY);
SharedMemoryArray shm = shmaOutputList.stream()
Expand Down Expand Up @@ -511,8 +517,11 @@ public void closeModel() {
throw new RuntimeException();
else if (task.status == TaskStatus.FAILED)
throw new RuntimeException();
else if (task.status == TaskStatus.CRASHED)
else if (task.status == TaskStatus.CRASHED) {
this.runner.close();
runner = null;
throw new RuntimeException();
}
this.runner.close();
this.runner = null;
return;
Expand Down

0 comments on commit 80bfa36

Please sign in to comment.