Skip to content

BrotliEncoder: Prevent duplicate close scheduling (#17175) - #17195

Merged
normanmaurer merged 1 commit into
5.0from
close5
Aug 3, 2026
Merged

normanmaurer merged 1 commit into
5.0from
close5

Conversation

@normanmaurer

Copy link
Copy Markdown
Member

Motivation:

BrotliEncoderChannel.close() closes its destination, which re-enters
BrotliEncoder.Writer.close(). The re-entrant call schedules another
finish task before isClosed is set. If the first finish fails, the
second task can retry with an already-failed close promise.

Modification:

Track whether writer close has already been initiated and ignore
subsequent close calls before scheduling another finish task.

Result:

Brotli encoder close is idempotent while a finish is pending, and
exceptional finalization no longer retries with an already-completed
promise.

Co-authored-by: multicode [email protected]

Motivation:

`BrotliEncoderChannel.close()` closes its destination, which re-enters
`BrotliEncoder.Writer.close()`. The re-entrant call schedules another
finish task before `isClosed` is set. If the first finish fails, the
second task can retry with an already-failed close promise.

Modification:

Track whether writer close has already been initiated and ignore
subsequent close calls before scheduling another finish task.

Result:

Brotli encoder close is idempotent while a finish is pending, and
exceptional finalization no longer retries with an already-completed
promise.

Co-authored-by: multicode <[email protected]>
@testlens-app

testlens-app Bot commented Aug 3, 2026 •

Copy link
Copy Markdown

🚨 TestLens detected 1 failed test 🚨

Here is what you can do:

  1. Inspect the test failures carefully.
  2. If you are convinced that some of the tests are flaky, you can mute them below.
  3. Finally, trigger a rerun by checking the rerun checkbox.

Test Summary

Build PR / macos-x86_64-java25-boringssl build > Netty/Transport/Native/KQueue

Test Runs Flakiness
KQueueDatagramUnicastIPv6MappedTest > testSimpleSendWithoutBind(TestInfo) ❌ 4% 🟡

🏷️ Commit: 6d86a3a
▶️ Tests: 40710 executed
⚪️ Checks: 12/12 completed

Test Failures

KQueueDatagramUnicastIPv6MappedTest > testSimpleSendWithoutBind(TestInfo) (Netty/Transport/Native/KQueue in Build PR / macos-x86_64-java25-boringssl build)
org.opentest4j.AssertionFailedError
	at io.netty.testsuite.transport.socket.DatagramUnicastTest.testSimpleSend0(DatagramUnicastTest.java:360)
	at io.netty.testsuite.transport.socket.DatagramUnicastTest.testSimpleSend(DatagramUnicastTest.java:192)
	at io.netty.testsuite.transport.socket.DatagramUnicastTest.testSimpleSendWithoutBind(DatagramUnicastTest.java:185)
	at io.netty.testsuite.transport.socket.DatagramUnicastTest$6.run(DatagramUnicastTest.java:178)
	at io.netty.testsuite.transport.socket.DatagramUnicastTest$6.run(DatagramUnicastTest.java:175)
	at io.netty.testsuite.transport.AbstractComboTestsuiteTest.run(AbstractComboTestsuiteTest.java:52)
	at io.netty.testsuite.transport.socket.DatagramUnicastTest.testSimpleSendWithoutBind(DatagramUnicastTest.java:175)
	at java.base/java.lang.reflect.Method.invoke(Method.java:565)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1604)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1604)

Muted Tests

Select tests to mute in this pull request:

  • KQueueDatagramUnicastIPv6MappedTest > testSimpleSendWithoutBind(TestInfo)

Reuse successful test results:

  • ♻️ Only rerun the tests that failed or were muted before

Click the checkbox to trigger a rerun:

  • Rerun jobs

Learn more about TestLens at testlens.app.

@normanmaurer
normanmaurer merged commit 13de88d into 5.0 Aug 3, 2026
11 of 13 checks passed
@normanmaurer
normanmaurer deleted the close5 branch August 3, 2026 10:50
@normanmaurer normanmaurer added this to the 5.0.0.Final milestone Aug 3, 2026
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