Skip to content

Fix SingletonListener lock leak when inner listener fails to start#3193

Merged
liliankasem merged 1 commit into
devfrom
liliankasem/bug/storagelockrelease
Apr 20, 2026
Merged

Fix SingletonListener lock leak when inner listener fails to start#3193
liliankasem merged 1 commit into
devfrom
liliankasem/bug/storagelockrelease

Conversation

@liliankasem

Copy link
Copy Markdown
Member

When _innerListener.StartAsync throws (e.g., storage error), the acquired blob lease was never released because _isListening was not set to true, so StopAsync/Dispose would skip the release.

Wrap _innerListener.StartAsync in try-catch in both StartAsync and TryAcquireLock to release the lock on failure, preventing the instance from holding the lease until recycled and blocking all other instances.

When _innerListener.StartAsync throws (e.g., storage error), the
acquired blob lease was never released because _isListening was not
set to true, so StopAsync/Dispose would skip the release.

Wrap _innerListener.StartAsync in try-catch in both StartAsync and
TryAcquireLock to release the lock on failure, preventing the instance
from holding the lease until recycled and blocking all other instances.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants