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 — Resume SslHandler when the delegated task was consumed elsewhere by normanmaurer · Pull Request #18372 · netty/netty

Conversation

@normanmaurer

@normanmaurer normanmaurer commented Nov 13, 2026 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

Motivation:

SslTasksRunner.run() returns silently when SSLEngine.getDelegatedTask() returns null, treating it as "the task was processed in the meantime". Nobody is guaranteed to call runComplete() in that case, so STATE_PROCESS_TASK stays set forever. decode() and flush() then return early for every subsequent call and the handshake stalls until it times out, even though the engine is ready to make progress.

Modification:

When getDelegatedTask() returns null, hop onto the EventExecutor and resume if STATE_PROCESS_TASK is still set. We only run one task at a time (STATE_PROCESS_TASK makes decode() and flush() return early while it is set), so there is no other runner that could still be executing a task and we can always resume. If the state was already cleared, somebody else resumed and we do nothing.

Add a regression test that uses an SSLEngine which consumes the first delegated task itself and returns null for it. Without the fix the handshake never completes.

Result:

The handshake can no longer get stuck when a delegated task was consumed before the SslTasksRunner got to run it.

Note: I could not find a code path in SslHandler that reaches this branch with the JDK engine or ReferenceCountedOpenSslEngine today, so this is a hardening change. It was found while looking at a timed out KQueueSocketSslEchoTest on #18368 and is not shown to be the cause of it.

Tested with ./mvnw -pl handler -am test -Dtest=SslHandlerTest (59 run, 0 failures, 1 skipped; checkstyle ran as part of it). The new test fails without the change.

Sorry, something went wrong.

Uh oh!

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

All reactions
@normanmaurer
Resume SslHandler when the delegated task was consumed elsewhere
1bc52e8
Motivation:

SslTasksRunner.run() returns silently when SSLEngine.getDelegatedTask()
returns null, treating it as "the task was processed in the meantime".
Nobody is guaranteed to call runComplete() in that case, so
STATE_PROCESS_TASK stays set forever. decode() and flush() then return
early for every subsequent call and the handshake stalls until it times
out, even though the engine is ready to make progress.

Modification:

When getDelegatedTask() returns null, hop onto the EventExecutor and
resume if STATE_PROCESS_TASK is still set and the engine no longer
reports NEED_TASK. If another runner is still executing a task, or has
already resumed, we leave the work to it.

Add a regression test that uses an SSLEngine which consumes the first
delegated task itself and returns null for it. Without the fix the
handshake never completes.

Result:

The handshake can no longer get stuck when a delegated task was consumed
before the SslTasksRunner got to run it.

I could not find a code path in SslHandler that reaches this branch with
the JDK engine or ReferenceCountedOpenSslEngine today, so this is a
hardening change. It was found while looking at a timed out
KQueueSocketSslEchoTest on netty#18368 and is not shown to be the cause of it.
@normanmaurer normanmaurer modified the milestones: 4.1.141.Final, 4.2.21.Final Nov 13, 2026
@normanmaurer normanmaurer added needs-cherry-pick-4.2 This PR should be cherry-picked to 4.2 once merged. needs-cherry-pick-5.0 This PR should be cherry-picked to 5.0 once merged. labels Nov 13, 2026
@normanmaurer
normanmaurer requested a review from chrisvest November 13, 2026 17:32
chrisvest
chrisvest reviewed Nov 13, 2026
View reviewed changes
Comment thread handler/src/main/java/io/netty/handler/ssl/SslHandler.java Resolved

Uh oh!

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

@normanmaurer
Always resume SslTasksRunner when no delegated task is available
983cd0f
Motivation:

Review feedback on netty#18372: only one delegated task is run at a time because
STATE_PROCESS_TASK blocks decode() and flush() while it is set, so there is no
other runner that could still be executing a task when getDelegatedTask()
returns null.

Modification:

Remove the NEED_TASK check from SslTasksRunner.resumeIfNoTaskIsPending() and
always resume when STATE_PROCESS_TASK is still set.

Result:

Simpler code with the same behavior.
@normanmaurer
normanmaurer requested a review from chrisvest November 13, 2026 18:53
chrisvest
chrisvest approved these changes Nov 13, 2026
View reviewed changes
@chrisvest
chrisvest enabled auto-merge (squash) November 13, 2026 19:40
@testlens-app

testlens-app Bot commented Nov 13, 2026

Copy link
Copy Markdown

✅ All tests passed ✅

🏷️ Commit: 983cd0f
▶️ Tests: 136112 executed
⚪️ Checks: 18/18 completed


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.

@chrisvest
chrisvest merged commit 63ac5f2 into netty:4.1 Nov 13, 2026
19 checks passed

Uh oh!

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

@netty-project-bot netty-project-bot mentioned this pull request Nov 13, 2026
Auto-port 4.2: Resume SslHandler when the delegated task was consumed elsewhere #18406
Merged
@netty-project-bot

netty-project-bot commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

Auto-port PR for 4.2: #18406

All reactions

Sorry, something went wrong.

Uh oh!

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

@github-actions github-actions Bot removed the needs-cherry-pick-4.2 This PR should be cherry-picked to 4.2 once merged. label Nov 13, 2026
@netty-project-bot netty-project-bot mentioned this pull request Nov 13, 2026
Auto-port 5.0: Resume SslHandler when the delegated task was consumed elsewhere #18407
Merged
@netty-project-bot

netty-project-bot commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

Auto-port PR for 5.0: #18407

All reactions

Sorry, something went wrong.

Uh oh!

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

@github-actions github-actions Bot removed the needs-cherry-pick-5.0 This PR should be cherry-picked to 5.0 once merged. label Nov 13, 2026
chrisvest pushed a commit that referenced this pull request Nov 14, 2026
@netty-project-bot @normanmaurer
Auto-port 5.0: Resume SslHandler when the delegated task was consumed…
3135683
… elsewhere (#18407)

Auto-port of #18372 to 5.0
Cherry-picked commit: 63ac5f2

---
Motivation:

`SslTasksRunner.run()` returns silently when
`SSLEngine.getDelegatedTask()` returns `null`, treating it as "the task
was processed in the meantime". Nobody is guaranteed to call
`runComplete()` in that case, so `STATE_PROCESS_TASK` stays set forever.
`decode()` and `flush()` then return early for every subsequent call and
the handshake stalls until it times out, even though the engine is ready
to make progress.

Modification:

When `getDelegatedTask()` returns `null`, hop onto the `EventExecutor`
and resume if `STATE_PROCESS_TASK` is still set. We only run one task at
a time (`STATE_PROCESS_TASK` makes `decode()` and `flush()` return early
while it is set), so there is no other runner that could still be
executing a task and we can always resume. If the state was already
cleared, somebody else resumed and we do nothing.

Add a regression test that uses an `SSLEngine` which consumes the first
delegated task itself and returns `null` for it. Without the fix the
handshake never completes.

Result:

The handshake can no longer get stuck when a delegated task was consumed
before the `SslTasksRunner` got to run it.

Note: I could not find a code path in `SslHandler` that reaches this
branch with the JDK engine or `ReferenceCountedOpenSslEngine` today, so
this is a hardening change. It was found while looking at a timed out
`KQueueSocketSslEchoTest` on #18368 and is not shown to be the cause of
it.

Tested with `./mvnw -pl handler -am test -Dtest=SslHandlerTest` (59 run,
0 failures, 1 skipped; checkstyle ran as part of it). The new test fails
without the change.

Co-authored-by: Norman Maurer <[email protected]>
chrisvest pushed a commit that referenced this pull request Nov 14, 2026
@netty-project-bot @normanmaurer
Auto-port 4.2: Resume SslHandler when the delegated task was consumed…
5640e63
… elsewhere (#18406)

Auto-port of #18372 to 4.2
Cherry-picked commit: 63ac5f2

---
Motivation:

`SslTasksRunner.run()` returns silently when
`SSLEngine.getDelegatedTask()` returns `null`, treating it as "the task
was processed in the meantime". Nobody is guaranteed to call
`runComplete()` in that case, so `STATE_PROCESS_TASK` stays set forever.
`decode()` and `flush()` then return early for every subsequent call and
the handshake stalls until it times out, even though the engine is ready
to make progress.

Modification:

When `getDelegatedTask()` returns `null`, hop onto the `EventExecutor`
and resume if `STATE_PROCESS_TASK` is still set. We only run one task at
a time (`STATE_PROCESS_TASK` makes `decode()` and `flush()` return early
while it is set), so there is no other runner that could still be
executing a task and we can always resume. If the state was already
cleared, somebody else resumed and we do nothing.

Add a regression test that uses an `SSLEngine` which consumes the first
delegated task itself and returns `null` for it. Without the fix the
handshake never completes.

Result:

The handshake can no longer get stuck when a delegated task was consumed
before the `SslTasksRunner` got to run it.

Note: I could not find a code path in `SslHandler` that reaches this
branch with the JDK engine or `ReferenceCountedOpenSslEngine` today, so
this is a hardening change. It was found while looking at a timed out
`KQueueSocketSslEchoTest` on #18368 and is not shown to be the cause of
it.

Tested with `./mvnw -pl handler -am test -Dtest=SslHandlerTest` (59 run,
0 failures, 1 skipped; checkstyle ran as part of it). The new test fails
without the change.

Co-authored-by: Norman Maurer <[email protected]>
@lhotari lhotari mentioned this pull request Nov 17, 2026
[improve][build][branch-4.x] Upgrade Netty to 4.1.141.Final to restore the aarch64 glibc floor and pick up bug fixes apache/pulsar#27655
Merged
1 of 11 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@chrisvest chrisvest chrisvest approved these changes

Uh oh!

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

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

4.1.141.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

@normanmaurer @netty-project-bot @chrisvest
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.