question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] BlobLeaseClient retry behavior causes transient 409 failures on Release

See original GitHub issue

Library name and version

Azure.Storage.Blobs 12.7.0

Describe the bug

Internal retry behavior in BloblLeaseClient.Release can expose callers to misleading 409 errors.

  • The lease is released by this first try, but a timeout happens
  • Release will automatically retry the release operation due to the timeout;
  • The second try fails and encounters a 409 LeaseIdMismatchWithLeaseOperation error since the lease has already been released by the first request
  • The Azure SDK throws a 409 exception

Report based on this issue.

Expected behavior

For a caller of the API, the LeaseIdMismatchWithLeaseOperation seems to indicate API misuse. Therefore, I think we should avoid throwing this in the case of transient failure followed by retry. One option could be to not throw at all in this scenario. Another (less desirable) option could be to throw, but use a different error so that callers can distinguish the particular outcome.

Actual behavior

See bug description

Reproduction Steps

Call Acquire[Async], then later call Release[Async] on the same BlobLeaseClient instance. This reproduces when Release[Async] hits a transient error.

I’m reporting on behalf of @rmt2021 who reported it here; perhaps they have a better repro.

Environment

@rmt2021 ?

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:12 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
Jaxelrcommented, Apr 4, 2023

I’m having a similar scenario on a production issue but on the the blobClient.UploadAsync operation. I suppose the same workaround will apply to this, but there would be no way to discern real scenarios wherein the blob was existing prior to the upload operation.

2reactions
navba-MSFTcommented, Jul 19, 2022

Adding Service team to look into this.

@xgithubtriage please look into this once you get a chance and provide an update.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Alternative for BlobContainerClient.CreateIfNotExistsAsync ...
This is a known problem, that a blob client CreateIfNotExists(Async) returns 409 during execution, in case if a container already has been ...
Read more >
Troubleshoot client application errors in Azure Storage ...
Retry policy did not allow for a retry. Failing with The remote server returned an error: (409) Conflict.. In this example, the log...
Read more >
Writing to CloudAppendBlob: The remote server returned ...
Sometimes, the “409 Conflict” error can be caused by temporary network or connectivity issues between your application and the Azure Blob ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found