Skip to content

Commit

Permalink
Merge pull request #20608 from stuartwdouglas/context-leak-fix
Browse files Browse the repository at this point in the history
Fix potential request context leak
  • Loading branch information
sberyozkin authored Oct 8, 2021
2 parents 11d725c + 8ab2d77 commit 609865a
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,7 @@ public void run() {
synchronized (this) {
if (isRequestScopeManagementRequired()) {
if (requestScopeActivated) {
if (position != handlers.length) {
disasociateRequestScope = true;
}
disasociateRequestScope = true;
requestScopeActivated = false;
}
} else {
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 609865a

Please sign in to comment.