wenxuwan opened a new pull request, #1244:
URL: https://github.com/apache/rocketmq-client-go/pull/1244

   ## What is the purpose of the change
   
   Fix resource retention and blocked shutdown paths when producers and 
consumers are repeatedly created and closed within a long-running process, such 
as a sidecar.
   
   Ensure that releasing the last shared client owner closes its transports, 
wakes pending requests, and allows background workers to exit. Rebuilding a 
client with previously used options must create an independent NameServer 
transport without retaining retired clients or blocking unrelated clients.
   
   ## Brief changelog
   
   - Close the NameServer transport when the last client owner releases the 
shared client.
   - Prevent remoting connections from reopening after shutdown, cancel pending 
TCP/TLS connection setup, and complete pending requests exactly once.
   - Make background delays, rebalance dispatch, and consumer concurrency-slot 
waits respond to shutdown.
   - Wake blocked pull-consumer `Poll()` calls on shutdown with the existing 
`errors.ErrService`; preserve `ErrNoNewMsg` for normal timeouts.
   - Stop transaction-check workers on producer shutdown and prevent repeated 
or failed starts from creating additional workers.
   - Isolate NameServer transports and route caches across client generations 
while preserving discovery configuration and credentials.
   - Copy NameServer snapshots outside the global client registry lock, then 
recheck the registry to handle concurrent creation safely.
   - Avoid capturing retired client options in transaction handlers so previous 
client generations can be garbage-collected.
   
   ## Verifying this change
   
   Added regression tests covering:
   
   - Repeated client, producer, and consumer creation and shutdown.
   - Last-owner connection cleanup and pending-request cancellation.
   - TLS handshake cancellation and concurrent response completion.
   - Blocked rebalance dispatch, concurrency-slot acquisition, and `Poll()` 
cancellation.
   - Real TCP route queries with ACL credentials after client reconstruction.
   - Overlapping old-client shutdown and replacement creation.
   - Unrelated client creation and shutdown during slow service discovery.
   - Garbage collection of retired client caches while the replacement remains 
alive.
   
   Validation passed on the final revision:
   
   - Full race tests for `internal/...` and `producer`.
   - Consumer lifecycle, shutdown, polling, and rebalance regression tests 
under the race detector.
   - SOFAMQ integration tests using the modified SDK under the race detector.
   
   Coverage percentage has not been measured.
   
   ## Checklist
   
   - [ ] File and link a GitHub issue for this change.
   - [ ] Format the PR title as `[ISSUE #<number>] <description>` using the 
linked issue.
   - [x] Provide a description explaining what changed, how, and why.
   - [ ] Verify the requested >80% test coverage. Regression tests have been 
added.
   - [ ] File an Apache Individual Contributor License Agreement if required.
   


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