Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure the post-process of a response is executed without a local request context #4527

Merged
merged 1 commit into from
Nov 10, 2022

Conversation

ikhoon
Copy link
Contributor

@ikhoon ikhoon commented Nov 10, 2022

Motivation:

A listener of a ChannelFuture can have a different request context in the thread local. Because Netty handles some pending requests in a batch task with an event loop having the different request context.

Modifications:

  • Remove a request context from thread local before invoking tryComplete()

Result:

Fixed a potential RequestContext leak when an incomplete HttpResponse is returned.

…uest context

Motivation:

A listener of a `ChannelFuture` can have a different request context in
the thread local because Netty may handle some pending requests in a
batch task which can may be triggered by a event loop having the
different request context.

Modifications:

- Remove a request context from thread local before invoking
  `tryComplete()`

Result:

Fixed a potential context leak when an incomplete `HttpResponse` is
returned.
@ikhoon ikhoon added the defect label Nov 10, 2022
@ikhoon ikhoon added this to the 1.20.3 milestone Nov 10, 2022
Copy link
Contributor

@minwoox minwoox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 👍 👍

Copy link
Contributor

@jrhee17 jrhee17 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @ikhoon ! 🙇 👍 🚀

ikhoon added a commit to ikhoon/armeria that referenced this pull request Nov 10, 2022
@ikhoon ikhoon merged commit 0930b18 into line:master Nov 10, 2022
@ikhoon ikhoon deleted the ctx-pop branch November 10, 2022 08:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants