@@ -199,8 +199,11 @@ private void launchModelLoadOnProcess() throws IOException, InterruptedException
199
199
throw new RuntimeException ();
200
200
else if (task .status == TaskStatus .FAILED )
201
201
throw new RuntimeException ();
202
- else if (task .status == TaskStatus .CRASHED )
202
+ else if (task .status == TaskStatus .CRASHED ) {
203
+ this .runner .close ();
204
+ runner = null ;
203
205
throw new RuntimeException ();
206
+ }
204
207
}
205
208
206
209
/**
@@ -321,8 +324,11 @@ void runInterprocessing(List<Tensor<T>> inputTensors, List<Tensor<R>> outputTens
321
324
throw new RuntimeException ();
322
325
else if (task .status == TaskStatus .FAILED )
323
326
throw new RuntimeException ();
324
- else if (task .status == TaskStatus .CRASHED )
327
+ else if (task .status == TaskStatus .CRASHED ) {
328
+ this .runner .close ();
329
+ runner = null ;
325
330
throw new RuntimeException ();
331
+ }
326
332
for (int i = 0 ; i < outputTensors .size (); i ++) {
327
333
String name = (String ) Types .decode (encOuts .get (i )).get (MEM_NAME_KEY );
328
334
SharedMemoryArray shm = shmaOutputList .stream ()
@@ -455,8 +461,11 @@ public void closeModel() {
455
461
throw new RuntimeException ();
456
462
else if (task .status == TaskStatus .FAILED )
457
463
throw new RuntimeException ();
458
- else if (task .status == TaskStatus .CRASHED )
464
+ else if (task .status == TaskStatus .CRASHED ) {
465
+ this .runner .close ();
466
+ runner = null ;
459
467
throw new RuntimeException ();
468
+ }
460
469
this .runner .close ();
461
470
this .runner = null ;
462
471
return ;
0 commit comments