f1amingo opened a new pull request, #1489:
URL: https://github.com/apache/rocketmq-clients/pull/1489

   ### Summary
   
   When `shutdown()` is called while an assignment scan RPC is still in flight, 
the scan's `.then` callback (`#syncProcessQueue`) runs after shutdown has 
dropped/aborted all process queues and cleared the table. With no running-state 
guard, it creates a brand-new `ProcessQueue` and calls 
`fetchMessageImmediately()` — that queue was never dropped or aborted, so its 
receive loop keeps issuing `ReceiveMessageRequest` forever, while every 
lifecycle component (heartbeat / settings sync / route / scan timers, telemetry 
sessions) has already been shut down and `NotifyClientTermination` has removed 
the client settings on the server. The result is a zombie client that only 
sends receive requests with no lifecycle traffic at all, hammering the proxy 
(observed in production: thousands of zombie loops from one process after 
per-task consumer create/shutdown churn). In addition, 
`RpcClientManager.close()` does not mark itself closed, so an escaped loop can 
lazily re-establish gRPC channels afte
 r shutdown.
   
   ### Changes
   
   - PushConsumer: add a `#shuttingDown` flag set as the very first action of 
`shutdown()`, guarding `#syncProcessQueue` and 
`createVirtualProcessQueueForLite` against creating queues during the whole 
shutdown window
   - ProcessQueue: check `#dropped` (not only `#aborted`) in 
`fetchMessageImmediately` / `#receiveMessageImmediately` / 
`#receiveMessageLater`
   - RpcClientManager: mark closed in `close()` and refuse to re-establish 
connections afterwards
   - Add regression test `PushConsumerShutdownRace.test.ts`
   
   ### How Did You Test This Change?
   
   - Regression test holds the `queryAssignment` promise in flight, completes 
`shutdown()`, then resolves it: before the fix the resurrected loop issued 
thousands of receives within 300ms; after the fix zero receives and zero 
process queues are created
   - Existing consumer unit tests pass; `tsc` build and `eslint` are clean
   


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