RockteMQ-AI commented on issue #10609:
URL: https://github.com/apache/rocketmq/issues/10609#issuecomment-4948214252
**Issue Evaluation**
Category: `type/bug` | Status: **Confirmed**
The reported issue has been verified against the current `develop` branch
(c4ce550a574e).
**Root Cause:** `ClientActivity.telemetry()` stores the gRPC
`responseObserver` in `GrpcClientChannel` via `setClientObserver()`, but
neither `onCompleted()` nor `onError()` calls `clearClientObserver()`. Since
`isActive()`/`isOpen()`/`isWritable()` all check `telemetryCommandRef.get() !=
null`, a closed stream continues to appear active.
**Impact:** Proxy may route operations to or consider alive channels whose
telemetry stream has already terminated. The stale reference is only eventually
cleared when the next `writeTelemetryCommand` throws — creating a window of
incorrect liveness state.
**Severity:** Medium — affects channel lifecycle accuracy in the Proxy gRPC
layer.
---
**Proposed Fix Summary:**
1. **`ClientActivity.java`** — In the anonymous `ContextStreamObserver`
inside `telemetry()`:
- Capture the `GrpcClientChannel` reference when settings are processed
- In `onCompleted()`: after `responseObserver.onCompleted()`, call
`grpcClientChannel.clearClientObserver(responseObserver)`
- In `onError()`: after `handleGrpcCancel()`, call
`grpcClientChannel.clearClientObserver(responseObserver)`
2. **`GrpcClientChannel.java`** — No changes needed. The existing
`clearClientObserver()` already uses `compareAndSet(future, null)`, which
safely handles the race condition where a delayed old-stream callback must not
clear a newer stream's observer.
3. **Edge cases covered:**
- Stream closes before any SETTINGS → `grpcClientChannel` is null → skip
clear (safe)
- Multiple topics for producer → final channel assignment is sufficient
(same channel via `clientId`)
- Concurrent new stream → `compareAndSet` protects the new observer
An automated fix proposal will be generated. Reply `/approve` to proceed
with PR generation, `/revise <feedback>` to request changes, or `/reject` to
decline.
---
*Automated evaluation by github-manager-bot*
--
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]