none
Download hangs when network cable unplugged

    Question

  • When I disable network while downloading, Download stops and exception arises after retry time (6*10 sec), and that's ok.

    The problem when I unplug network cable, it doesn't behave in the same manner, instead it's blocked in DownloadToStream line and hangs forever.

     var dwnLoadOption = new BlobRequestOptions { RetryPolicy = new LinearRetry(TimeSpan.FromSeconds(10.0), 6) };
    _blockBlob.DownloadToStreamAsync(stream, null, dwnLoadOption, null, cancellationToken).Wait();

    I tried await, await + ConfigureAwait(false) and DownloadToStream, but same result.


    Sunday, April 24, 2016 4:30 PM

Answers

  • We don't have support for this beyond MaximumExecutionTime currently but we are investigating options for adding such support in the future. For now, you can monitor the amount of data downloaded to your stream and cancel the task if no data at all is downloaded for a period of time. The length of time to wait will depend on the tradeoff between your application's latency requirements and tolerance for temporary network unavailability.

    • Marked as answer by maha_saad Tuesday, May 3, 2016 3:47 PM
    Tuesday, May 3, 2016 3:22 PM

All replies

  • Hi,

    So when you unplug the network cable you expect the same behavior as when the network was disconnected but it doesn't work that way?
    When you replug the network cable, are there any changes or it's still blocked in DownloadToStream line and hangs forever?

    Regards,
    Malar.

    Monday, April 25, 2016 9:33 AM
  • So when you unplug the network cable you expect the same behavior as when the network was disconnected but it doesn't work that way?

    Yes you are right.

    When you replug the network cable, are there any changes or it's still blocked in DownloadToStream line and hangs forever?

    1. If I re-plugged quickly it resumes 

    2. If I re-plugged after time it's still blocking

    I think re-plugging within the retry time (60 sec in my case) only works well.

    Thanks

    Tuesday, April 26, 2016 2:19 PM
  • We provide a MaximumExecutionTime property on BlobRequestOptions. This will let you specify an upper bound to the amount of time an API will take before failing with timeout. The MaximumExecutionTime is the total time the operation is allowed, including retries. This will cause the request to time out even in the presence of total loss of incoming packets.

    • Marked as answer by maha_saad Tuesday, May 3, 2016 12:51 PM
    • Unmarked as answer by maha_saad Tuesday, May 3, 2016 2:29 PM
    Tuesday, May 3, 2016 9:30 AM
  • Thanks Michael
    Tuesday, May 3, 2016 12:52 PM
  • MaximumExecutionTime sets timeout for the whole download operation operation, and it's not my case, I want to set timeout only for internet corruption by unplugging cable.

    Tuesday, May 3, 2016 2:33 PM
  • We don't have support for this beyond MaximumExecutionTime currently but we are investigating options for adding such support in the future. For now, you can monitor the amount of data downloaded to your stream and cancel the task if no data at all is downloaded for a period of time. The length of time to wait will depend on the tradeoff between your application's latency requirements and tolerance for temporary network unavailability.

    • Marked as answer by maha_saad Tuesday, May 3, 2016 3:47 PM
    Tuesday, May 3, 2016 3:22 PM