[ 
https://issues.apache.org/jira/browse/IGNITE-28480?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Aleksandr Polovtsev updated IGNITE-28480:
-----------------------------------------
    Description: 
The following exception was observed in CI during 
{{ItJdbcSslCustomCipherTest#jdbcIncompatibleCiphers}}:
  
{code:java}
  [WARN][nioEventLoopGroup-1152-12][AbstractChannelHandlerContext] An exception 
'java.lang.NullPointerException:                                                
                           
  Cannot invoke 
"org.apache.ignite.internal.client.io.netty.NettyClientConnection.onDisconnected(java.lang.Throwable)"
                                                                       
  because the return value of 
"org.apache.ignite.internal.client.io.netty.NettyClientMessageHandler.connection(io.netty.channel.ChannelHandlerContext)"
 is null'                             
  was thrown by a user handler's exceptionCaught() method while handling the 
following exception:                                                            
                                
  io.netty.handler.codec.DecoderException: javax.net.ssl.SSLHandshakeException: 
Received fatal alert: protocol_version                                          
                             
        at 
io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:515)
                                                                                
             
        at 
io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:296)
                                                                                
            
        ...                                                                     
                                                                                
                             
  Caused by: javax.net.ssl.SSLHandshakeException: Received fatal alert: 
protocol_version                                                                
                                     
        at sun.security.ssl.Alert.createSSLException(Alert.java:131)            
                                                                                
                             
        at sun.security.ssl.TransportContext.fatal(TransportContext.java:358)   
                                                                                
                             
        at sun.security.ssl.Alert$AlertConsumer.consume(Alert.java:293)         
                                                                                
                             
        ...                                                                     
                                                                                
                             
        at io.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:1493)         
                                                                                
                             
        at io.netty.handler.ssl.SslHandler.decode(SslHandler.java:1435)         
                                                                                
                             
        ...               
{code}
                                                                                
                                                                                
                           
The root cause is a race between the SSL handshake failure and the 
connectFut.addListener registration in 
NettyClientConnectionMultiplexer.openAsync. TCP connect can complete before 
addListener is called, if the SSL alert arrives before that task runs, 
exceptionCaught fires with ATTR_CONN still null, causing the NPE.          

> NPE in NettyClientMessageHandler when SSL handshake fails
> ---------------------------------------------------------
>
>                 Key: IGNITE-28480
>                 URL: https://issues.apache.org/jira/browse/IGNITE-28480
>             Project: Ignite
>          Issue Type: Bug
>            Reporter: Aleksandr Polovtsev
>            Assignee: Aleksandr Polovtsev
>            Priority: Major
>              Labels: ignite-3
>
> The following exception was observed in CI during 
> {{ItJdbcSslCustomCipherTest#jdbcIncompatibleCiphers}}:
>   
> {code:java}
>   [WARN][nioEventLoopGroup-1152-12][AbstractChannelHandlerContext] An 
> exception 'java.lang.NullPointerException:                                    
>                                        
>   Cannot invoke 
> "org.apache.ignite.internal.client.io.netty.NettyClientConnection.onDisconnected(java.lang.Throwable)"
>                                                                        
>   because the return value of 
> "org.apache.ignite.internal.client.io.netty.NettyClientMessageHandler.connection(io.netty.channel.ChannelHandlerContext)"
>  is null'                             
>   was thrown by a user handler's exceptionCaught() method while handling the 
> following exception:                                                          
>                                   
>   io.netty.handler.codec.DecoderException: 
> javax.net.ssl.SSLHandshakeException: Received fatal alert: protocol_version   
>                                                                     
>         at 
> io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:515)
>                                                                               
>                
>         at 
> io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:296)
>                                                                               
>               
>         ...                                                                   
>                                                                               
>                                  
>   Caused by: javax.net.ssl.SSLHandshakeException: Received fatal alert: 
> protocol_version                                                              
>                                        
>         at sun.security.ssl.Alert.createSSLException(Alert.java:131)          
>                                                                               
>                                  
>         at sun.security.ssl.TransportContext.fatal(TransportContext.java:358) 
>                                                                               
>                                  
>         at sun.security.ssl.Alert$AlertConsumer.consume(Alert.java:293)       
>                                                                               
>                                  
>         ...                                                                   
>                                                                               
>                                  
>         at io.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:1493)       
>                                                                               
>                                  
>         at io.netty.handler.ssl.SslHandler.decode(SslHandler.java:1435)       
>                                                                               
>                                  
>         ...               
> {code}
>                                                                               
>                                                                               
>                                
> The root cause is a race between the SSL handshake failure and the 
> connectFut.addListener registration in 
> NettyClientConnectionMultiplexer.openAsync. TCP connect can complete before 
> addListener is called, if the SSL alert arrives before that task runs, 
> exceptionCaught fires with ATTR_CONN still null, causing the NPE.          



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to