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] Blob Storage's downloadToFile deletes files after `toFuture` is called

See original GitHub issue

Describe the bug After calling downloadToFile (with or without overwrite = true), the operation succeeds, and the file, for a brief moment, is successfully downloaded and persisted on disk. However, if a toFuture subscriber is attached and then subsequently converted to a Scala Future (using either Scala’s built in compat, or via Reactor’s Scala extensions), a cancel signal is fired, and the handler here fires and deletes the file: https://github.com/Azure/azure-sdk-for-java/blob/b59f999110e7a12004b51918b04b7ede444824a5/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/specialized/BlobAsyncClientBase.java#L1039

edit - quick update - Mono’s toFuture does indeed fire off a cancel: https://github.com/reactor/reactor-core/blob/c6b75f2578ee5f201ac06add2239322cc5b7bfcd/reactor-core/src/main/java/reactor/core/publisher/MonoToCompletableFuture.java#L59, which makes the downloadToFile methods impossible to use if a CompletableFuture is desired. May I suggest loosening the check for deletion? 😄

I’m not very familiar with Reactor, and would be happy to find out if I’m doing something wrong, or if there’s a workaround. We are on a Scala codebase that relies heavily on Futures, so not using a Future is not quite an option.

Exception or Stack Trace N/A

To Reproduce Steps to reproduce the behavior: See the following snippet

Code Snippet

blobContainerClient
  .getBlobAsyncClient(myBlobKey)
  .downloadToFile("my/path")
  .onComplete { ...file is fine here... }
  .doFinally { ... eventually `cancel` is fired instead of `complete` ... }
  .toFuture.asScala.map { ... file disappears ... }

Expected behavior Don’t delete my file 😦

Screenshots N/A

Setup (please complete the following information):

  • OS: macOS Catalina
  • IDE : Intellij Ultimate
  • Version of the Library used: 12.4.0

Additional context Could be related to https://github.com/spring-projects/spring-framework/issues/22952, even though this appears to be fixed?

Information Checklist Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report

  • Bug Description Added
  • Repro Steps Added
  • Setup information Added

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
Petermarcucommented, Jul 30, 2020

Can this issue be closed?

1reaction
anuchandycommented, Mar 11, 2020

The issue is fixed in the reactor-core.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Manage and restore soft-deleted blobs - Azure Storage
The Undelete Blob operation restores soft-deleted blobs and any deleted snapshots associated with those blobs. Calling Undelete Blob on a blob ...
Read more >
Java, delete blob file after it passes through BlobTrigger
I am using AzureFunctions, AzureStorageExplorer and Java. After uploading a blob file it activates the blob trigger and runs code.
Read more >
Image binary deleted from blob storage after deleting image ...
Deleting an image from the recycle bin causes the image binary of any other images with the same name to be deleted from...
Read more >
How to recover accidental deletes in Azure Blob Storage
This article covers soft delete feature in Azure Blob Storage to ... along with different types of storages (Containers, File shares, ...
Read more >
Azure Blob Storage SDK for Go - Go Packages
Valid go.mod file ... Azure Blob Storage SDK for Go ... The container and any blobs contained within it are later deleted during...
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