Skip to content

Auto-port 4.1: Use LocalIoHandler instead of DefaultEventLoop for LocalChannel tests in codec-http2 - #17708

Merged
normanmaurer merged 1 commit into
4.1from
auto-port-pr-17697-to-4.1
Oct 1, 2026
Merged

normanmaurer merged 1 commit into
4.1from
auto-port-pr-17697-to-4.1

Conversation

@netty-project-bot

Copy link
Copy Markdown
Contributor

Auto-port of #17697 to 4.1
Cherry-picked commit: d3817ad


Motivation:

Http2MultiplexTransportTest failed on CI in the LeakPresenceExtension
afterAll check ("Possible memory leak detected for resource scope")
although every test in the class passed. The check waits up to 5 seconds
for resources to be released, so something stayed open for good rather
than just shutting down slowly.

Several tests run LocalChannel / LocalServerChannel on a DefaultEventLoop
and then call shutdownGracefully() without waiting. Unlike
LocalIoHandler (and NioIoHandler for the other tests in the class),
DefaultEventLoop does not close the channels registered with it when it
shuts down. A server-side child channel is therefore only closed if the
peer-close task still runs before the loop terminates. If it does not,
the channel and whatever it still holds (for example the large wrapped
payloads written by the auto-read tests added in #17617) is never
released, which the leak presence detector reports.

Modification:

  • Use new MultiThreadIoEventLoopGroup(1, LocalIoHandler.newFactory())
    instead of new DefaultEventLoop() in the LocalChannel based tests of
    Http2MultiplexTransportTest, Http2MultiplexCodecBuilderTest and
    Http2StreamChannelBootstrapTest. LocalIoHandler closes all registered
    channels when the group shuts down. A single thread is kept so server
    and client still share one event loop as before.

Result:

Channels of the LocalChannel tests are always closed when their event
loop group shuts down, which removes one possible source of the flaky
leak report.

… in codec-http2 (#17697)

Motivation:

Http2MultiplexTransportTest failed on CI in the LeakPresenceExtension
afterAll check ("Possible memory leak detected for resource scope")
although every test in the class passed. The check waits up to 5 seconds
for resources to be released, so something stayed open for good rather
than just shutting down slowly.

Several tests run LocalChannel / LocalServerChannel on a
DefaultEventLoop
and then call shutdownGracefully() without waiting. Unlike
LocalIoHandler (and NioIoHandler for the other tests in the class),
DefaultEventLoop does not close the channels registered with it when it
shuts down. A server-side child channel is therefore only closed if the
peer-close task still runs before the loop terminates. If it does not,
the channel and whatever it still holds (for example the large wrapped
payloads written by the auto-read tests added in #17617) is never
released, which the leak presence detector reports.

Modification:

- Use `new MultiThreadIoEventLoopGroup(1, LocalIoHandler.newFactory())`
instead of `new DefaultEventLoop()` in the LocalChannel based tests of
Http2MultiplexTransportTest, Http2MultiplexCodecBuilderTest and
Http2StreamChannelBootstrapTest. LocalIoHandler closes all registered
channels when the group shuts down. A single thread is kept so server
and client still share one event loop as before.

Result:

Channels of the LocalChannel tests are always closed when their event
loop group shuts down, which removes one possible source of the flaky
leak report.

(cherry picked from commit d3817ad)
@normanmaurer normanmaurer added this to the 4.1.139.Final milestone Oct 1, 2026
@normanmaurer
normanmaurer merged commit 55e8a6a into 4.1 Oct 1, 2026
0 of 3 checks passed
@normanmaurer
normanmaurer deleted the auto-port-pr-17697-to-4.1 branch October 1, 2026 15:46
lltopk pushed a commit to lltopk/netty that referenced this pull request Oct 24, 2026
…alChannel tests in codec-http2 (netty#17708)

Auto-port of netty#17697 to 4.1
Cherry-picked commit: d3817ad

---
Motivation:

Http2MultiplexTransportTest failed on CI in the LeakPresenceExtension
afterAll check ("Possible memory leak detected for resource scope")
although every test in the class passed. The check waits up to 5 seconds
for resources to be released, so something stayed open for good rather
than just shutting down slowly.

Several tests run LocalChannel / LocalServerChannel on a
DefaultEventLoop
and then call shutdownGracefully() without waiting. Unlike
LocalIoHandler (and NioIoHandler for the other tests in the class),
DefaultEventLoop does not close the channels registered with it when it
shuts down. A server-side child channel is therefore only closed if the
peer-close task still runs before the loop terminates. If it does not,
the channel and whatever it still holds (for example the large wrapped
payloads written by the auto-read tests added in netty#17617) is never
released, which the leak presence detector reports.

Modification:

- Use `new MultiThreadIoEventLoopGroup(1, LocalIoHandler.newFactory())`
instead of `new DefaultEventLoop()` in the LocalChannel based tests of
Http2MultiplexTransportTest, Http2MultiplexCodecBuilderTest and
Http2StreamChannelBootstrapTest. LocalIoHandler closes all registered
channels when the group shuts down. A single thread is kept so server
and client still share one event loop as before.

Result:

Channels of the LocalChannel tests are always closed when their event
loop group shuts down, which removes one possible source of the flaky
leak report.

Co-authored-by: Norman Maurer <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants