Skip to content

OF-3176: Fix NPE race condition in DirectTLS channelActive handler#3155

Open
guusdk wants to merge 2 commits intoigniterealtime:mainfrom
guusdk:OF-3176_Netty-processing-blocking-events-redux
Open

OF-3176: Fix NPE race condition in DirectTLS channelActive handler#3155
guusdk wants to merge 2 commits intoigniterealtime:mainfrom
guusdk:OF-3176_Netty-processing-blocking-events-redux

Conversation

@guusdk
Copy link
Member

@guusdk guusdk commented Mar 5, 2026

CONNECTION attribute could be null when channelActive fired before handlerAdded had executed on the blockingHandlerExecutor, causing a NullPointerException when attempting to start DirectTLS.

Fix by deferring DirectTLS initialisation behind stanzaHandlerFuture, which guarantees CONNECTION is set before it is accessed. Applied to both inbound (NettyServerInitializer) and outbound (NettySessionInitializer) connection handlers.

guusdk added 2 commits March 5, 2026 09:20
CONNECTION attribute could be null when channelActive fired before handlerAdded had executed on the blockingHandlerExecutor, causing a NullPointerException when attempting to start DirectTLS.

Fix by deferring DirectTLS initialisation behind stanzaHandlerFuture, which guarantees CONNECTION is set before it is accessed. Applied to both inbound (NettyServerInitializer) and outbound (NettySessionInitializer) connection handlers.
…onManagerImpl

Previously, the shared Netty thread pools for outbound S2S were initialized and torn down from ConnectionListener, causing a race condition where outbound connections could be attempted before the inbound S2S listener had started.

Resources are now initialized in ConnectionManagerImpl.initialize() and destroyed in ConnectionManagerImpl.destroy(), ensuring they are available for the full duration of the server lifecycle.
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