@@ -220,8 +220,11 @@ private void launchModelLoadOnProcess() throws IOException, InterruptedException
220
220
throw new RuntimeException ();
221
221
else if (task .status == TaskStatus .FAILED )
222
222
throw new RuntimeException ();
223
- else if (task .status == TaskStatus .CRASHED )
223
+ else if (task .status == TaskStatus .CRASHED ) {
224
+ this .runner .close ();
225
+ runner = null ;
224
226
throw new RuntimeException ();
227
+ }
225
228
}
226
229
227
230
/**
@@ -377,8 +380,11 @@ void runInterprocessing(List<Tensor<T>> inputTensors, List<Tensor<R>> outputTens
377
380
throw new RuntimeException ();
378
381
else if (task .status == TaskStatus .FAILED )
379
382
throw new RuntimeException ();
380
- else if (task .status == TaskStatus .CRASHED )
383
+ else if (task .status == TaskStatus .CRASHED ) {
384
+ this .runner .close ();
385
+ runner = null ;
381
386
throw new RuntimeException ();
387
+ }
382
388
for (int i = 0 ; i < outputTensors .size (); i ++) {
383
389
String name = (String ) Types .decode (encOuts .get (i )).get (MEM_NAME_KEY );
384
390
SharedMemoryArray shm = shmaOutputList .stream ()
@@ -511,8 +517,11 @@ public void closeModel() {
511
517
throw new RuntimeException ();
512
518
else if (task .status == TaskStatus .FAILED )
513
519
throw new RuntimeException ();
514
- else if (task .status == TaskStatus .CRASHED )
520
+ else if (task .status == TaskStatus .CRASHED ) {
521
+ this .runner .close ();
522
+ runner = null ;
515
523
throw new RuntimeException ();
524
+ }
516
525
this .runner .close ();
517
526
this .runner = null ;
518
527
return ;
0 commit comments