zjncs opened a new pull request, #11141:
URL: https://github.com/apache/rocketmq/pull/11141

   ### Motivation
   
   The telemetry stream observer keeps `proxyCtx = null` until the first 
`onNext` delivers a context. A client that opens the telemetry stream and then 
cancels (or drops the connection) without sending a single `TelemetryCommand` 
made `onError` call `handleGrpcCancel` with a null context, which threw a 
`NullPointerException` in `ctx.getClientID()` and masked the intended cancel 
handling.
   
   ### Modifications
   
   Return early when the context is absent; there is no client id to clean up 
in that case.
   
   ### Verification
   
   Fail-before (new test, run against the unpatched code):
   
   ```
   ClientActivityTest#testTelemetryOnErrorBeforeAnyMessage
   java.lang.NullPointerException: Cannot invoke 
"org.apache.rocketmq.proxy.common.ProxyContext.getClientID()" because "ctx" is 
null
     ClientActivityTest.testTelemetryOnErrorBeforeAnyMessage:439
   ```
   
   Pass-after:
   
   ```
   Tests run: 16, Failures: 0, Errors: 0, Skipped: 0 -- ClientActivityTest
   ```
   


-- 
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]

Reply via email to