GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Auto-port 5.0: Avoid classloader leak via the shared TransferEncodingNotAllowedException by netty-project-bot · Pull Request #18355 · netty/netty

Conversation

@netty-project-bot

@netty-project-bot netty-project-bot commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

Auto-port of #18342 to 5.0
Cherry-picked commit: 742a53e


Motivation:

HttpObjectDecoder keeps a static TransferEncodingNotAllowedException. ThrowableUtil.unknownStackTrace(...) replaces its visible stack trace, but not its native backtrace, which references the classes of every frame on the stack of whatever code triggered the class initialization. When Netty is shared by the web applications of a servlet container, this pins the class loader of the first one that created an HTTP decoder. Same mechanism as #17128.

Modification:

  • Create the shared instance with a writable stack trace disabled, through a package-private factory, as QpackException.newStatic(...) does.
  • To pass that setting on, add a protected constructor (String, Throwable, boolean enableSuppression, boolean writableStackTrace) to CodecException and DecoderException.
  • Add a regression test.

This adds public API: the two protected constructors above. The alternative was to make TransferEncodingNotAllowedException non-final, so that it could have a stackless subclass like SpdyProtocolException's.

Result:

The shared TransferEncodingNotAllowedException no longer keeps the class loader of its first caller alive. Its stack trace is now empty, instead of naming HttpObjectDecoder.readHeaders(ByteBuf).

The same exception exists in 4.1 and 5.0.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@cardamon @netty-project-bot
Avoid classloader leak via the shared TransferEncodingNotAllowedExcep…
035b71e
…tion (#18342)

Motivation:

`HttpObjectDecoder` keeps a static
`TransferEncodingNotAllowedException`.
`ThrowableUtil.unknownStackTrace(...)` replaces its visible stack trace,
but not its native backtrace, which references the classes of every
frame on the stack of whatever code triggered the class initialization.
When Netty is shared by the web applications of a servlet container,
this pins the class loader of the first one that created an HTTP
decoder. Same mechanism as #17128.

Modification:

- Create the shared instance with a writable stack trace disabled,
through a package-private factory, as `QpackException.newStatic(...)`
does.
- To pass that setting on, add a protected constructor `(String,
Throwable, boolean enableSuppression, boolean writableStackTrace)` to
`CodecException` and `DecoderException`.
- Add a regression test.

**This adds public API:** the two protected constructors above. The
alternative was to make `TransferEncodingNotAllowedException` non-final,
so that it could have a stackless subclass like
`SpdyProtocolException`'s.

Result:

The shared `TransferEncodingNotAllowedException` no longer keeps the
class loader of its first caller alive. Its stack trace is now empty,
instead of naming `HttpObjectDecoder.readHeaders(ByteBuf)`.

(cherry picked from commit 742a53e)
@netty-project-bot netty-project-bot mentioned this pull request Nov 12, 2026
Avoid classloader leak via the shared TransferEncodingNotAllowedException #18342
Merged
@normanmaurer
Declare checked exception in testTransferEncodingNotAllowedDoesNotFil…
dc1ceb7
…lInStackTrace

Motivation:

EmbeddedChannel.writeInbound(...) and finish() declare 'throws Exception' on 5.0, so the test cherry-picked from 4.1 did not compile.

Modification:

Add 'throws Exception' to the test method.

Result:

The test compiles on 5.0.
@testlens-app

testlens-app Bot commented Nov 12, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

🚨 All tests passed but jobs failed 🚨

Failed Jobs without Test Failures

❌ Build PR / linux-x86_64-java25-awslc build

🏷️ Commit: dc1ceb7
▶️ Tests: 60866 executed
⚪️ Checks: 20/20 completed

Rerun Controls

Click the checkbox to trigger a rerun:

  • Rerun jobs

Learn more about TestLens at testlens.app/docs.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@normanmaurer normanmaurer added this to the 5.0.0.Final milestone Nov 12, 2026
@normanmaurer
normanmaurer merged commit 32b4785 into 5.0 Nov 12, 2026
20 of 21 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@normanmaurer
normanmaurer deleted the auto-port-pr-18342-to-5.0 branch November 12, 2026 14:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

5.0.0.Final

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@netty-project-bot @normanmaurer @cardamon
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.