Azure / Azure/azure-sdk-for-cpp

Synchronize ConsumerClient::Close with concurrent resource creation

Open
#7,355 0 comments 0 reactions 0 assignees View on GitHub
Client Event Hubs
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.