@@ -188,8 +188,11 @@ private void launchModelLoadOnProcess() throws IOException, InterruptedException
188188 throw new RuntimeException ();
189189 else if (task .status == TaskStatus .FAILED )
190190 throw new RuntimeException ();
191- else if (task .status == TaskStatus .CRASHED )
191+ else if (task .status == TaskStatus .CRASHED ) {
192+ this .runner .close ();
193+ runner = null ;
192194 throw new RuntimeException ();
195+ }
193196 }
194197
195198 /**
@@ -301,8 +304,11 @@ void runInterprocessing(List<Tensor<T>> inputTensors, List<Tensor<R>> outputTens
301304 throw new RuntimeException ();
302305 else if (task .status == TaskStatus .FAILED )
303306 throw new RuntimeException ();
304- else if (task .status == TaskStatus .CRASHED )
307+ else if (task .status == TaskStatus .CRASHED ) {
308+ this .runner .close ();
309+ runner = null ;
305310 throw new RuntimeException ();
311+ }
306312 for (int i = 0 ; i < outputTensors .size (); i ++) {
307313 String name = (String ) Types .decode (encOuts .get (i )).get (MEM_NAME_KEY );
308314 SharedMemoryArray shm = shmaOutputList .stream ()
@@ -364,8 +370,11 @@ public void closeModel() {
364370 throw new RuntimeException ();
365371 else if (task .status == TaskStatus .FAILED )
366372 throw new RuntimeException ();
367- else if (task .status == TaskStatus .CRASHED )
373+ else if (task .status == TaskStatus .CRASHED ) {
374+ this .runner .close ();
375+ runner = null ;
368376 throw new RuntimeException ();
377+ }
369378 this .runner .close ();
370379 this .runner = null ;
371380 return ;
0 commit comments