Azure / azure-storage-net

Microsoft Azure Storage Libraries for .NET

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot access a disposed object. Object name: 'SslStream'.

raigol opened this issue · comments

.NET 4.7.2
Microsoft.Azure.Storage.Blob 11.1.3

We are using CloudBlockBlob to download Blobs. In logs we get lot of exceptions

System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'SslStream'.
at System.Net.ConnectStream.EndRead(IAsyncResult asyncResult)
at System.Net.Http.HttpClientHandler.WebExceptionWrapperStream.EndRead(IAsyncResult asyncResult)
at Microsoft.Azure.Storage.Core.ByteCountingStream.EndRead(IAsyncResult asyncResult)
at System.Threading.Tasks.TaskFactory1.FromAsyncTrimPromise1.Complete(TInstance thisRef, Func`3 endMethod, IAsyncResult asyncResult, Boolean requiresSynchronization)

the code

   using (var blobMemoryStream = new MemoryStream())
   {
      await cloudBlockBlob
            .DownloadToStreamAsync(blobMemoryStream, null, optionsWithRetryPolicy, null)
             .ConfigureAwait(false);

I found exactly same error from 2018, seems the problem is still not fixed.
#722

can this issue be fixed? or what is recommended workaround?

Any updates on this issue? I seem to hit this issue more frequently when using Semaphores to download files in batch as opposed to one at a time

We are having the same issue. I think this is related to this issue Azure/azure-sdk-for-net#17527

It seems to be fixed in Azure.Core 1.9.1 which is used by Azure.Storage. So if you update to the latest version of Azure.Storage it should be solved.