Summary
ConsumerClient::Close accesses the session and connection maps without m_sessionsLock while resource creation writes those maps under the lock.
Motivation
The unlocked access is a data race. Detaching the maps under the lock addresses map mutation, but a complete fix must also define calls that overlap the gap between EnsureSession and GetSession. This behavior predates pull request #7354 and is outside its teardown failure scope.
Proposal
- Define the ConsumerClient concurrency contract for Close and CreatePartitionClient.
- Detach cached sessions and connections while holding m_sessionsLock.
- Run blocking AMQP teardown after releasing the lock.
- Add deterministic coverage for Close that overlaps resource creation.
Found while reviewing #7354.
Summary
ConsumerClient::Close accesses the session and connection maps without m_sessionsLock while resource creation writes those maps under the lock.
Motivation
The unlocked access is a data race. Detaching the maps under the lock addresses map mutation, but a complete fix must also define calls that overlap the gap between EnsureSession and GetSession. This behavior predates pull request #7354 and is outside its teardown failure scope.
Proposal
Found while reviewing #7354.