From fd19334972317105ad934ecc2f3dbda2e02c3d92 Mon Sep 17 00:00:00 2001 From: Ludovic DEHON Date: Fri, 16 Aug 2024 21:31:23 +0200 Subject: [PATCH] fix(webserver): create execution don't display error close #4673 --- .../controllers/api/ExecutionController.java | 13 ++++++++++-- .../api/ExecutionControllerTest.java | 20 +++++++++++++++++++ 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/webserver/src/main/java/io/kestra/webserver/controllers/api/ExecutionController.java b/webserver/src/main/java/io/kestra/webserver/controllers/api/ExecutionController.java index 272bed22e0b..b631b5cda40 100644 --- a/webserver/src/main/java/io/kestra/webserver/controllers/api/ExecutionController.java +++ b/webserver/src/main/java/io/kestra/webserver/controllers/api/ExecutionController.java @@ -56,6 +56,7 @@ import io.micronaut.scheduling.TaskExecutors; import io.micronaut.scheduling.annotation.ExecuteOn; import io.micronaut.validation.Validated; +import io.netty.util.IllegalReferenceCountException; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.media.Content; @@ -590,13 +591,21 @@ public Publisher create( sink.success(item); } }); - sink.onDispose(() -> receive.run()); + + sink.onDispose(receive::run); } } catch (IOException e) { sink.error(new RuntimeException(e)); } }) - .doOnError(t -> Flux.from(inputs).subscribeOn(Schedulers.boundedElastic()).blockLast()); // need to consume the inputs in case of error; + .doOnError(t -> { + // need to consume the inputs in case of error, that can failed, but we ignored + try { + Flux.from(inputs).subscribeOn(Schedulers.boundedElastic()).blockLast(); + } catch (IllegalReferenceCountException ignored) { + + } + }); } private List