Skip to content

Guard against null TimeoutsHolder in NettyConnectListener.onSuccess#2176

Open
hyperxpro wants to merge 1 commit intomainfrom
fix-2172
Open

Guard against null TimeoutsHolder in NettyConnectListener.onSuccess#2176
hyperxpro wants to merge 1 commit intomainfrom
fix-2172

Conversation

@hyperxpro
Copy link
Copy Markdown
Member

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

@hyperxpro
Copy link
Copy Markdown
Member Author

@jaredstehler PTAL

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.

1 participant