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

   ### Which Issue(s) This PR Fixes
   
   No linked issue.
   
   ### Brief Description
   
   When a push consumer shuts down with a QueryAssignment request in flight, 
its untracked scan can outlive shutdown and apply a late response. Separately, 
a failed QueryAssignment currently falls through as an empty assignment and 
drops existing process queues.
   
   Give the assignment scanner a child context and a completion signal. Cancel 
and join it before draining receives and shutting down the consumption 
executor. Serialize scanner registration and assignment application with 
stopping, and discard successful responses received after cancellation. The 
client context remains available for consumption/ACK cleanup. Keep the existing 
one-second initial delay, five-second interval, and serial scanning.
   
   On query failures, retain the last successful assignment and process queues 
and continue scanning other topics. A successful empty response still removes 
the previous queues.
   
   ### How Did You Test This Change?
   
   Go 1.27.3, from `golang`:
   
   - `go build ./...`
   - `go test ./... -timeout 5m`
   - `go vet ./...`
   
   Go 1.24.0 compatibility and concurrency checks:
   
   - `GOTOOLCHAIN=go1.24.0 go test -race ./... -timeout 5m`
   - `GOTOOLCHAIN=go1.24.0 go test -race -run '^TestPushAssignment' -count=5 
-timeout 120s .`
   
   Also checked `gofmt` and `git diff --check`. Before the fix, the new 
query-failure regression failed for all five consumer modes and all four error 
cases.
   
   Regression coverage includes:
   
   - Standard Push, FIFO, and Lite Push, with FIFO acceleration disabled and 
enabled.
   - Transport errors, request timeout, cancellation, and non-OK server status 
preserve existing queues and cached assignments; a subsequent successful empty 
response removes them.
   - Shutdown cancels a blocked query and joins the scan before executor 
shutdown; a deliberately delayed successful response cannot change queues or 
cached assignments. Client cancellation happens after the consumption/ACK 
cleanup stage.
   - Initial-delay cancellation, concurrent registration/stopping, duplicate 
scanner registration, parent-client cancellation, and failed-startup cleanup.
   - Periodic retries remain serial while a query spans several ticks, and one 
failed topic does not prevent another topic's successful update.
   - An initially empty assignment cache can recover on a successful retry and 
resume receiving.
   
   ### Review Evidence and Compatibility
   
   - Call chain inspected: `NewPushConsumer`/`newPushConsumer`, 
`NewLitePushConsumer` and its `Start` delegation, both push-consumer examples, 
`Start` scan registration, first/periodic callbacks, `scanAssignments`, 
`queryAssignments`, `ClientManager.QueryAssignments` and its deadline handling, 
queue synchronization/create/drop/fetch, receive callbacks, 
`Subscribe`/`Unsubscribe`, and `GracefulStop`. The scan mutex is not held 
during RPCs; the scan is canceled independently of ACK/settlement operations.
   - Configuration branches: standard/FIFO/Lite consumers and acceleration 
on/off are covered by the regressions. Request deadlines remain in effect. 
Authentication, TLS, public configuration, and public APIs are unchanged.
   - Failure/cleanup paths: synchronous startup failure, asynchronous query 
failure, timeout/cancellation, delayed success after stopping, successful 
empty/nonempty results, periodic retry, and scanner registration racing 
shutdown are covered. Stopping is serialized with result application, and 
waiting occurs after releasing the lifecycle mutex.
   - Upgrade/recovery: no protocol or persisted-data format changes, so there 
is no new old-client/new-server, new-client/old-server, mixed-version, 
rolling-upgrade, or downgrade requirement. Assignments are in memory and are 
rebuilt after restart; the empty-cache recovery test covers rebuilding state 
that was absent or cleared previously.
   - Remaining validation gap: no broker-backed mixed-version or shutdown 
stress test was run. Such a test should inject slow/intermittently failing 
QueryAssignment responses, assert failed queries preserve the previous queues, 
and assert no assignment update occurs after shutdown completes.
   


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