Skip to content

[8.12] Fix leaked HTTP response sent after close (#105293)#105305

Merged
elasticsearchmachine merged 2 commits intoelastic:8.12from
DaveCTurner:backport/8.12/pr-105293
Feb 8, 2024
Merged

[8.12] Fix leaked HTTP response sent after close (#105293)#105305
elasticsearchmachine merged 2 commits intoelastic:8.12from
DaveCTurner:backport/8.12/pr-105293

Conversation

@DaveCTurner
Copy link
Copy Markdown
Member

Backports the following commits to 8.12:

Today a `HttpResponse` is always released via a `ChannelPromise` which
means the release happens on a network thread. However, it's possible we
try and send a `HttpResponse` after the node has got far enough through
shutdown that it doesn't have any running network threads left, which
means the response just leaks.

This is no big deal in production, it becomes irrelevant when the
process exits, but in tests we start and stop many nodes within the same
process so mustn't leak anything.

At this point in shutdown, all HTTP channels are now closed, so it's
sufficient to check whether the channel is open first, and to fail the
listener on the calling thread if not. That's what this commit does.

Closes elastic#104651
@DaveCTurner DaveCTurner added :Distributed/Network Http and internode communication implementations >bug auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) backport Team:Distributed Meta label for distributed team. labels Feb 8, 2024
@elasticsearchmachine elasticsearchmachine merged commit 6addf18 into elastic:8.12 Feb 8, 2024
@DaveCTurner DaveCTurner deleted the backport/8.12/pr-105293 branch February 8, 2024 22:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) backport >bug :Distributed/Network Http and internode communication implementations Team:Distributed Meta label for distributed team. v8.12.2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants