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.

The lease mechanism leads to loss of transferred data

See original GitHub issue

The lease mechanism leads to loss of transferred data

I am working on android application which transfer data to azure storage. I successfully implemented it in Kotlin in following way.

val containerClient: BlobContainerClient = getBlobContainerClient(resourceDirectory)

if (!containerClient.exists()) {
    containerClient.create()
}

containerClient.getBlobClient(resourceName).uploadFromFile(resourcePath)

Then I had to implement lease mechanism. I used BlobLeaseClientBuilder to build LeaseClient and to acquire lease. Code below.

val containerClient: BlobContainerClient = getBlobContainerClient(resourceDirectory)

if (!containerClient.exists()) {
    containerClient.create()
}

val client: BlobClient = containerClient.getBlobClient(resourceName)

val leaseClient: BlobLeaseClient = BlobLeaseClientBuilder()
    .blobClient(client) 
    // .leaseId(UUID.randomUUID().toString()) - also tested
    .buildClient()

val acquiredLeaseId: String = leaseClient.acquireLease(-1)

client.uploadFromFile(
    resourcePath, //filePath
    null, // parallelTransferOptions
    null, // headers
    null, // metadata
    null, // tier
    BlobRequestConditions().apply { leaseId =  acquiredLeaseId }, // accessConditions
    null // timeout
)

leaseClient.releaseLease()

Uploading data in such way does not work. Only container is created correctly (containerClient.create()) and azure seems to drop all request when lease is set (because of incorrect leaseId?)

Environment:

  • OS: development: Ubunto 18.04, tested on OnePlus 6T with Android 10
  • IDE: Android Studio: 3.5.3
  • Version of the library: group: ‘com.azure’, name: ‘azure-storage-blob’, version: ‘12.0.1’

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
rkowalski4commented, Jun 1, 2020

Hi, I’m sorry for lack of information. I fixed this out and everything works perfectly. Thank you so much for your support!

1reaction
joshfreecommented, Apr 30, 2020

Thanks for opening this android issue on BlobLeaseClient, @rkowalski4. @rickle-msft and @anuchandy will be able to follow up with you shortly.

/cc @bsiegel as FYI

Read more comments on GitHub >

github_iconTop Results From Across the Web

Lease modifications - assets.kpmg
Identifying all lease agreements and extracting lease data. Lessees will now recognise most leases on-balance sheet.
Read more >
Leases Navigating the guidance in ASC 842 | Grant Thornton
Lease provisions that require the lessee to reimburse the lessor for a deficiency in residual value due to damage, extraordinary wear ...
Read more >
Guidance Material and Best Practices for Aircraft Leases - IATA
The lease agreement will almost always be drafted in such a way that the Lessor shall not be liable for any damages or...
Read more >
A Tenant's Practical Guide to Commercial Leases
Some leases provide that the landlord can choose what the rental mechanism is under the lease, so the landlord can choose that the...
Read more >
Before You Sign That Lease… - Harvard Business Review
Office space rental is often a big expense for a small company. But it can be unnecessarily ... Beyond this, many landlords create...
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