@@ -211,8 +211,11 @@ private void launchModelLoadOnProcess() throws IOException, InterruptedException
211
211
throw new RuntimeException ();
212
212
else if (task .status == TaskStatus .FAILED )
213
213
throw new RuntimeException ();
214
- else if (task .status == TaskStatus .CRASHED )
214
+ else if (task .status == TaskStatus .CRASHED ) {
215
+ this .runner .close ();
216
+ runner = null ;
215
217
throw new RuntimeException ();
218
+ }
216
219
}
217
220
218
221
/**
@@ -368,8 +371,11 @@ void runInterprocessing(List<Tensor<T>> inputTensors, List<Tensor<R>> outputTens
368
371
throw new RuntimeException ();
369
372
else if (task .status == TaskStatus .FAILED )
370
373
throw new RuntimeException ();
371
- else if (task .status == TaskStatus .CRASHED )
374
+ else if (task .status == TaskStatus .CRASHED ) {
375
+ this .runner .close ();
376
+ runner = null ;
372
377
throw new RuntimeException ();
378
+ }
373
379
for (int i = 0 ; i < outputTensors .size (); i ++) {
374
380
String name = (String ) Types .decode (encOuts .get (i )).get (MEM_NAME_KEY );
375
381
SharedMemoryArray shm = shmaOutputList .stream ()
@@ -499,8 +505,11 @@ public void closeModel() {
499
505
throw new RuntimeException ();
500
506
else if (task .status == TaskStatus .FAILED )
501
507
throw new RuntimeException ();
502
- else if (task .status == TaskStatus .CRASHED )
508
+ else if (task .status == TaskStatus .CRASHED ) {
509
+ this .runner .close ();
510
+ runner = null ;
503
511
throw new RuntimeException ();
512
+ }
504
513
this .runner .close ();
505
514
this .runner = null ;
506
515
return ;
0 commit comments