@@ -211,8 +211,11 @@ private void launchModelLoadOnProcess() throws IOException, InterruptedException
211211 throw new RuntimeException ();
212212 else if (task .status == TaskStatus .FAILED )
213213 throw new RuntimeException ();
214- else if (task .status == TaskStatus .CRASHED )
214+ else if (task .status == TaskStatus .CRASHED ) {
215+ this .runner .close ();
216+ runner = null ;
215217 throw new RuntimeException ();
218+ }
216219 }
217220
218221 /**
@@ -368,8 +371,11 @@ void runInterprocessing(List<Tensor<T>> inputTensors, List<Tensor<R>> outputTens
368371 throw new RuntimeException ();
369372 else if (task .status == TaskStatus .FAILED )
370373 throw new RuntimeException ();
371- else if (task .status == TaskStatus .CRASHED )
374+ else if (task .status == TaskStatus .CRASHED ) {
375+ this .runner .close ();
376+ runner = null ;
372377 throw new RuntimeException ();
378+ }
373379 for (int i = 0 ; i < outputTensors .size (); i ++) {
374380 String name = (String ) Types .decode (encOuts .get (i )).get (MEM_NAME_KEY );
375381 SharedMemoryArray shm = shmaOutputList .stream ()
@@ -499,8 +505,11 @@ public void closeModel() {
499505 throw new RuntimeException ();
500506 else if (task .status == TaskStatus .FAILED )
501507 throw new RuntimeException ();
502- else if (task .status == TaskStatus .CRASHED )
508+ else if (task .status == TaskStatus .CRASHED ) {
509+ this .runner .close ();
510+ runner = null ;
503511 throw new RuntimeException ();
512+ }
504513 this .runner .close ();
505514 this .runner = null ;
506515 return ;
0 commit comments