Azure / Azure/azure-sdk-for-cpp
Synchronize ConsumerClient::Close with concurrent resource creation
- Dominant language
- C++
- Stars
- 205
- Forks
- 172
- Avg merge
- 1d 15m
- Merged PRs (30d)
- 33
Description
## 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.
Contributor guide
Assessment
This issue has not been assessed yet.