Skip to content

Fix NPE in NettyConnectListener#2127

Merged
hyperxpro merged 2 commits into
mainfrom
fix-2124
Nov 26, 2025
Merged

Fix NPE in NettyConnectListener#2127
hyperxpro merged 2 commits into
mainfrom
fix-2124

Conversation

@hyperxpro
Copy link
Copy Markdown
Member

Fixes a NullPointerException triggered when timeout logging tries to append a null remoteAddress

Fixes #2124

@hyperxpro hyperxpro merged commit a177bd3 into main Nov 26, 2025
8 of 9 checks passed
@hyperxpro hyperxpro deleted the fix-2124 branch November 26, 2025 18:04
hyperxpro added a commit that referenced this pull request May 10, 2026
…2176)

Motivation

NettyConnectListener.onSuccess NPEs on
timeoutsHolder.setResolvedRemoteAddress(...) when a request timeout
fires concurrently with a successful connect: abort() calls
cancelTimeouts() (nulls the holder) before setting isDone, and per JMM
the IO thread can observe holder==null while isDone==0. PR #2127 only
guarded the remoteAddress parameter, not the holder.

Modification

- Add null guard on timeoutsHolder in onSuccess — close the channel and
bail out if the holder was nulled out concurrently.
- Broaden futureIsAlreadyCancelled → futureIsAlreadyCompleted
(isCancelled() → isDone()) so aborted futures don't slip past the
early-out (abort()/done() set isDone, not isCancelled).
- Release the partition-key lock on both early-exit paths.
- Add NettyConnectListenerTest reproducing the exact NPE from the bug
report.

Fixes
#2172

Co-authored-by: Ubuntu <ubuntu@ip-172-31-9-101.ap-south-1.compute.internal>
hyperxpro added a commit that referenced this pull request May 12, 2026
…2176)

Motivation

NettyConnectListener.onSuccess NPEs on
timeoutsHolder.setResolvedRemoteAddress(...) when a request timeout
fires concurrently with a successful connect: abort() calls
cancelTimeouts() (nulls the holder) before setting isDone, and per JMM
the IO thread can observe holder==null while isDone==0. PR #2127 only
guarded the remoteAddress parameter, not the holder.

Modification

- Add null guard on timeoutsHolder in onSuccess — close the channel and
bail out if the holder was nulled out concurrently.
- Broaden futureIsAlreadyCancelled → futureIsAlreadyCompleted
(isCancelled() → isDone()) so aborted futures don't slip past the
early-out (abort()/done() set isDone, not isCancelled).
- Release the partition-key lock on both early-exit paths.
- Add NettyConnectListenerTest reproducing the exact NPE from the bug
report.

Fixes
#2172
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.

NPE in NettyConnectListener

1 participant