You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by "sashapolo (via GitHub)" <gi...@apache.org> on 2026/04/07 11:31:28 UTC

[PR] IGNITE-28480 Fix NPE in NettyClientMessageHandler when SSL handshake fails [ignite-3]

sashapolo opened a new pull request, #7940:
URL: https://github.com/apache/ignite-3/pull/7940

   https://issues.apache.org/jira/browse/IGNITE-28480
   
   Thank you for submitting the pull request.
   
   To streamline the review process of the patch and ensure better code quality
   we ask both an author and a reviewer to verify the following:
   
   ### The Review Checklist
   - [ ] **Formal criteria:** TC status, codestyle, mandatory documentation. Also make sure to complete the following:  
   \- There is a single JIRA ticket related to the pull request.  
   \- The web-link to the pull request is attached to the JIRA ticket.  
   \- The JIRA ticket has the Patch Available state.  
   \- The description of the JIRA ticket explains WHAT was made, WHY and HOW.  
   \- The pull request title is treated as the final commit message. The following pattern must be used: IGNITE-XXXX Change summary where XXXX - number of JIRA issue.
   - [ ] **Design:** new code conforms with the design principles of the components it is added to.
   - [ ] **Patch quality:** patch cannot be split into smaller pieces, its size must be reasonable.
   - [ ] **Code quality:** code is clean and readable, necessary developer documentation is added if needed.
   - [ ] **Tests code quality:** test set covers positive/negative scenarios, happy/edge cases. Tests are effective in terms of execution time and resources.
   
   ### Notes
   - [Apache Ignite Coding Guidelines](https://cwiki.apache.org/confluence/display/IGNITE/Java+Code+Style+Guide)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-28480 Fix NPE in NettyClientMessageHandler when SSL handshake fails [ignite-3]

Posted by "sashapolo (via GitHub)" <gi...@apache.org>.
sashapolo commented on PR #7940:
URL: https://github.com/apache/ignite-3/pull/7940#issuecomment-4198971645

   > Can we add a test for this?
   
   I wasn't able to ever reproduce this issue locally and it only affects the logs, so I think we should simply monitor TC


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-28480 Fix NPE in NettyClientMessageHandler when SSL handshake fails [ignite-3]

Posted by "sashapolo (via GitHub)" <gi...@apache.org>.
sashapolo merged PR #7940:
URL: https://github.com/apache/ignite-3/pull/7940


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-28480 Fix NPE in NettyClientMessageHandler when SSL handshake fails [ignite-3]

Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #7940:
URL: https://github.com/apache/ignite-3/pull/7940#discussion_r3044703956


##########
modules/client/src/main/java/org/apache/ignite/internal/client/io/netty/NettyClientMessageHandler.java:
##########
@@ -37,13 +37,22 @@ public void channelRead(ChannelHandlerContext ctx, Object msg) {
     /** {@inheritDoc} */
     @Override
     public void channelInactive(ChannelHandlerContext ctx) {
-        connection(ctx).onDisconnected(null);
+        NettyClientConnection conn = connection(ctx);
+
+        if (conn != null) {
+            conn.onDisconnected(null);
+        }

Review Comment:
   After this change, `connection(ctx)` is treated as nullable in `channelInactive`/`exceptionCaught`, but `channelRead` still dereferences it unconditionally. If a read ever happens before `ATTR_CONN` is set (same scenario that caused the NPE here), this would still throw; additionally, any dropped inbound `ByteBuf` would need an explicit release to avoid leaks. Align the null-handling strategy across all handler callbacks (either guarantee the attribute is set before reads, or guard `channelRead` as well).



##########
modules/client/src/main/java/org/apache/ignite/internal/client/io/netty/NettyClientMessageHandler.java:
##########
@@ -37,13 +37,22 @@ public void channelRead(ChannelHandlerContext ctx, Object msg) {
     /** {@inheritDoc} */
     @Override
     public void channelInactive(ChannelHandlerContext ctx) {
-        connection(ctx).onDisconnected(null);
+        NettyClientConnection conn = connection(ctx);
+
+        if (conn != null) {
+            conn.onDisconnected(null);
+        }
     }
 
     /** {@inheritDoc} */
     @Override
     public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
-        connection(ctx).onDisconnected(cause);
+        NettyClientConnection conn = connection(ctx);
+
+        if (conn != null) {
+            conn.onDisconnected(cause);

Review Comment:
   `exceptionCaught` now silently drops the original failure when `ATTR_CONN` is not set (conn == null). In that scenario the SSL handshake exception (or other root cause) never reaches `ClientConnectionStateHandler`, so higher layers may only observe a generic "Channel is closed" later, losing the actionable error details. Consider persisting the throwable on the channel (or creating/attaching the connection attribute earlier) so that the real cause is delivered to the state handler once/if the connection object is created, or at minimum propagate/log the exception instead of swallowing it when conn is null.
   ```suggestion
               conn.onDisconnected(cause);
           } else {
               ctx.fireExceptionCaught(cause);
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] IGNITE-28480 Fix NPE in NettyClientMessageHandler when SSL handshake fails [ignite-3]

Posted by "ptupitsyn (via GitHub)" <gi...@apache.org>.
ptupitsyn commented on PR #7940:
URL: https://github.com/apache/ignite-3/pull/7940#issuecomment-4198643595

   Can we add a test for this?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org