frankgh commented on code in PR #4936:
URL: https://github.com/apache/cassandra/pull/4936#discussion_r3596688695


##########
src/java/org/apache/cassandra/transport/PreV5Handlers.java:
##########
@@ -337,7 +337,9 @@ public void exceptionCaught(final ChannelHandlerContext 
ctx, Throwable cause)
             if (ctx.channel().isOpen())
             {
                 Predicate<Throwable> handler = 
ExceptionHandlers.getUnexpectedExceptionHandler(ctx.channel(), false);
-                ErrorMessage errorMessage = ErrorMessage.fromException(cause, 
handler);
+                // No request in scope at the channel level; a 
WrappedException cause carries the frame's
+                // stream id and overrides this fallback, otherwise the 
channel is torn down for fatal errors.
+                ErrorMessage errorMessage = ErrorMessage.fromException(cause, 
Message.NO_REQUEST_STREAM_ID, handler);

Review Comment:
   There's one case where the negotiation fails during the protocol negotiation 
(app layer negotiation). This causes the 
`org.apache.cassandra.transport.PreV5Handlers.ExceptionHandler#exceptionCaught` 
code path above. And `errorMessage.encode` will hit the assertion in 
`org.apache.cassandra.transport.Message#encode`. If we set the stream Id to 
`UNSET_STREAM_ID` here, this would trigger the assertion error. So we'll need 
to do special handling for that case. This can be showcased in the 
`org.apache.cassandra.transport.CQLConnectionTest#handleErrorDuringNegotiation` 
test.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to