diff --git a/independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/core/AbstractResteasyReactiveContext.java b/independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/core/AbstractResteasyReactiveContext.java index e8d1f3976addf..1b08a3ec8c7f1 100644 --- a/independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/core/AbstractResteasyReactiveContext.java +++ b/independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/core/AbstractResteasyReactiveContext.java @@ -143,9 +143,7 @@ public void run() { synchronized (this) { if (isRequestScopeManagementRequired()) { if (requestScopeActivated) { - if (position != handlers.length) { - disasociateRequestScope = true; - } + disasociateRequestScope = true; requestScopeActivated = false; } } else { @@ -176,6 +174,10 @@ public void run() { // we need to make sure we don't close the underlying stream in the event loop if the task // has been offloaded to the executor if ((position == handlers.length && !processingSuspended) || aborted) { + if (requestScopeActivated) { + requestScopeDeactivated(); + currentRequestScope.deactivate(); + } close(); } else { if (disasociateRequestScope) {