Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

I am troubleshooting a legacy web service (asmx) that works to verify prices on partner websites. We have recently turned on the HttpWebRequest.AutomaticDecompression flag (DecompressionMethods.Deflate | DecompressionMethods.GZip) to hopefully speed up responses from some partners with large (650K+) pages. The code is old and proprietary so it is difficult to post an example so I will try and provide some implementation highlights:

  • Legacy .NET 3.5 ASMX web service running in a 4.5 app pool (allows TLS 1.2)
  • Each request (potentially) spawns multiple worker Threads; One for each partner to check.
  • Worker thread creates HttpWebRequest using automatic decompression and uses async methods to wait for partner responses:

    IAsyncResult r = (IAsyncResult)wreq.BeginGetResponse(new AsyncCallback(RespCallback), rs);

  • Since going into our test environment the result has been to get a few successful responses followed by a hard crash in the app pool. The mini dump shows a stack overflow (apparently) caused by the processing of a compressed stream:

    System.dll!System.IO.Compression.OutputWindow.CopyTo(byte[] output, int offset, int length) Unknown
    System.dll!System.IO.Compression.Inflater.Inflate(byte[] bytes, int offset, int length) Unknown
    System.dll!System.IO.Compression.DeflateStream.BeginRead(byte[] array, int offset, int count, System.AsyncCallback asyncCallback, object asyncState)    Unknown
    System.dll!System.IO.Compression.GZipStream.BeginRead(byte[] array, int offset, int count, System.AsyncCallback asyncCallback, object asyncState)   Unknown
    ... many more frames ...
    PriceSvc.dll!ns.Price.ClientGetAsync.ReadCallBack(System.IAsyncResult asyncResult) Line 699 C#
    System.dll!System.IO.Compression.DeflateStream.BeginRead(byte[] array, int offset, int count, System.AsyncCallback asyncCallback, object asyncState)    Unknown
    System.dll!System.IO.Compression.GZipStream.BeginRead(byte[] array, int offset, int count, System.AsyncCallback asyncCallback, object asyncState)   Unknown
    System.dll!System.Net.GZipWrapperStream.BeginRead(byte[] buffer, int offset, int size, System.AsyncCallback callback, object state) Unknown
    PriceSvc.dll!ns.Price.ClientGetAsync.ReadCallBack(System.IAsyncResult asyncResult) Line 699 C#
    System.dll!System.IO.Compression.DeflateStream.BeginRead(byte[] array, int offset, int count, System.AsyncCallback asyncCallback, object asyncState)    Unknown
    System.dll!System.IO.Compression.GZipStream.BeginRead(byte[] array, int offset, int count, System.AsyncCallback asyncCallback, object asyncState)   Unknown
    System.dll!System.Net.GZipWrapperStream.BeginRead(byte[] buffer, int offset, int size, System.AsyncCallback callback, object state) Unknown
    PriceSvc.dll!ns.Price.ClientGetAsync.ReadCallBack(System.IAsyncResult asyncResult) Line 699 C#
    System.dll!System.IO.Compression.DeflateStream.BeginRead(byte[] array, int offset, int count, System.AsyncCallback asyncCallback, object asyncState)    Unknown
    System.dll!System.IO.Compression.GZipStream.BeginRead(byte[] array, int offset, int count, System.AsyncCallback asyncCallback, object asyncState)   Unknown
    System.dll!System.Net.GZipWrapperStream.BeginRead(byte[] buffer, int offset, int size, System.AsyncCallback callback, object state) Unknown
    PriceSvc.dll!ns.Price.ClientGetAsync.ReadCallBack(System.IAsyncResult asyncResult) Line 699 C#
    System.dll!System.IO.Compression.DeflateStream.BeginRead(byte[] array, int offset, int count, System.AsyncCallback asyncCallback, object asyncState)    Unknown
    System.dll!System.IO.Compression.GZipStream.BeginRead(byte[] array, int offset, int count, System.AsyncCallback asyncCallback, object asyncState)   Unknown
    System.dll!System.Net.GZipWrapperStream.BeginRead(byte[] buffer, int offset, int size, System.AsyncCallback callback, object state) Unknown
    PriceSvc.dll!ns.Price.ClientGetAsync.ReadCallBack(System.IAsyncResult asyncResult) Line 699 C#
    System.dll!System.IO.Compression.DeflateStream.BeginRead(byte[] array, int offset, int count, System.AsyncCallback asyncCallback, object asyncState)    Unknown
    System.dll!System.IO.Compression.GZipStream.BeginRead(byte[] array, int offset, int count, System.AsyncCallback asyncCallback, object asyncState)   Unknown
    System.dll!System.Net.GZipWrapperStream.BeginRead(byte[] buffer, int offset, int size, System.AsyncCallback callback, object state) Unknown
    PriceSvc.dll!ns.Price.ClientGetAsync.ReadCallBack(System.IAsyncResult asyncResult) Line 699 C#
    System.dll!System.IO.Compression.DeflateStream.BeginRead(byte[] array, int offset, int count, System.AsyncCallback asyncCallback, object asyncState)    Unknown
    System.dll!System.IO.Compression.GZipStream.BeginRead(byte[] array, int offset, int count, System.AsyncCallback asyncCallback, object asyncState)   Unknown
    System.dll!System.Net.GZipWrapperStream.BeginRead(byte[] buffer, int offset, int size, System.AsyncCallback callback, object state) Unknown
    PriceSvc.dll!ns.Price.ClientGetAsync.ReadCallBack(System.IAsyncResult asyncResult) Line 699 C#
    System.dll!System.IO.Compression.DeflateStream.BeginRead(byte[] array, int offset, int count, System.AsyncCallback asyncCallback, object asyncState)    Unknown
    System.dll!System.IO.Compression.GZipStream.BeginRead(byte[] array, int offset, int count, System.AsyncCallback asyncCallback, object asyncState)   Unknown
    System.dll!System.Net.GZipWrapperStream.BeginRead(byte[] buffer, int offset, int size, System.AsyncCallback callback, object state) Unknown
    PriceSvc.dll!ns.Price.ClientGetAsync.ReadCallBack(System.IAsyncResult asyncResult) Line 699 C#
    System.dll!System.IO.Compression.DeflateStream.BeginRead(byte[] array, int offset, int count, System.AsyncCallback asyncCallback, object asyncState)    Unknown
    System.dll!System.IO.Compression.GZipStream.BeginRead(byte[] array, int offset, int count, System.AsyncCallback asyncCallback, object asyncState)   Unknown
    System.dll!System.Net.GZipWrapperStream.BeginRead(byte[] buffer, int offset, int size, System.AsyncCallback callback, object state) Unknown
    PriceSvc.dll!ns.Price.ClientGetAsync.ReadCallBack(System.IAsyncResult asyncResult) Line 699 C#
    System.dll!System.IO.Compression.DeflateStream.BeginRead(byte[] array, int offset, int count, System.AsyncCallback asyncCallback, object asyncState)    Unknown
    System.dll!System.IO.Compression.GZipStream.BeginRead(byte[] array, int offset, int count, System.AsyncCallback asyncCallback, object asyncState)   Unknown
    System.dll!System.Net.GZipWrapperStream.BeginRead(byte[] buffer, int offset, int size, System.AsyncCallback callback, object state) Unknown
    PriceSvc.dll!ns.Price.ClientGetAsync.ReadCallBack(System.IAsyncResult asyncResult) Line 699 C#
    System.dll!System.IO.Compression.DeflateStream.BeginRead(byte[] array, int offset, int count, System.AsyncCallback asyncCallback, object asyncState)    Unknown
    System.dll!System.IO.Compression.GZipStream.BeginRead(byte[] array, int offset, int count, System.AsyncCallback asyncCallback, object asyncState)   Unknown
    System.dll!System.Net.GZipWrapperStream.BeginRead(byte[] buffer, int offset, int size, System.AsyncCallback callback, object state) Unknown
    PriceSvc.dll!ns.Price.ClientGetAsync.ReadCallBack(System.IAsyncResult asyncResult) Line 699 C#
    System.dll!System.IO.Compression.DeflateStream.BeginRead(byte[] array, int offset, int count, System.AsyncCallback asyncCallback, object asyncState)    Unknown
    System.dll!System.IO.Compression.GZipStream.BeginRead(byte[] array, int offset, int count, System.AsyncCallback asyncCallback, object asyncState)   Unknown
    System.dll!System.Net.GZipWrapperStream.BeginRead(byte[] buffer, int offset, int size, System.AsyncCallback callback, object state) Unknown
    PriceSvc.dll!ns.Price.ClientGetAsync.ReadCallBack(System.IAsyncResult asyncResult) Line 699 C#
    System.dll!System.IO.Compression.DeflateStream.BeginRead(byte[] array, int offset, int count, System.AsyncCallback asyncCallback, object asyncState)    Unknown
    System.dll!System.IO.Compression.GZipStream.BeginRead(byte[] array, int offset, int count, System.AsyncCallback asyncCallback, object asyncState)   Unknown
    System.dll!System.Net.GZipWrapperStream.BeginRead(byte[] buffer, int offset, int size, System.AsyncCallback callback, object state) Unknown
    PriceSvc.dll!ns.Price.ClientGetAsync.ReadCallBack(System.IAsyncResult asyncResult) Line 699 C#
    System.dll!System.IO.Compression.DeflateStream.BeginRead(byte[] array, int offset, int count, System.AsyncCallback asyncCallback, object asyncState)    Unknown
    System.dll!System.IO.Compression.GZipStream.BeginRead(byte[] array, int offset, int count, System.AsyncCallback asyncCallback, object asyncState)   Unknown
    System.dll!System.Net.GZipWrapperStream.BeginRead(byte[] buffer, int offset, int size, System.AsyncCallback callback, object state) Unknown
    PriceSvc.dll!ns.Price.ClientGetAsync.ReadCallBack(System.IAsyncResult asyncResult) Line 699 C#
    System.dll!System.IO.Compression.DeflateStream.BeginRead(byte[] array, int offset, int count, System.AsyncCallback asyncCallback, object asyncState)    Unknown
    System.dll!System.IO.Compression.GZipStream.BeginRead(byte[] array, int offset, int count, System.AsyncCallback asyncCallback, object asyncState)   Unknown
    System.dll!System.Net.GZipWrapperStream.BeginRead(byte[] buffer, int offset, int size, System.AsyncCallback callback, object state) Unknown
    PriceSvc.dll!ns.Price.ClientGetAsync.ReadCallBack(System.IAsyncResult asyncResult) Line 699 C#
    System.dll!System.IO.Compression.DeflateStream.BeginRead(byte[] array, int offset, int count, System.AsyncCallback asyncCallback, object asyncState)    Unknown
    System.dll!System.IO.Compression.GZipStream.BeginRead(byte[] array, int offset, int count, System.AsyncCallback asyncCallback, object asyncState)   Unknown
    System.dll!System.Net.GZipWrapperStream.BeginRead(byte[] buffer, int offset, int size, System.AsyncCallback callback, object state) Unknown
    PriceSvc.dll!ns.Price.ClientGetAsync.ReadCallBack(System.IAsyncResult asyncResult) Line 699 C#
    System.dll!System.IO.Compression.DeflateStream.BeginRead(byte[] array, int offset, int count, System.AsyncCallback asyncCallback, object asyncState)    Unknown
    System.dll!System.IO.Compression.GZipStream.BeginRead(byte[] array, int offset, int count, System.AsyncCallback asyncCallback, object asyncState)   Unknown
    System.dll!System.Net.GZipWrapperStream.BeginRead(byte[] buffer, int offset, int size, System.AsyncCallback callback, object state) Unknown
    PriceSvc.dll!ns.Price.ClientGetAsync.ReadCallBack(System.IAsyncResult asyncResult) Line 699 C#
    System.dll!System.IO.Compression.DeflateStream.BeginRead(byte[] array, int offset, int count, System.AsyncCallback asyncCallback, object asyncState)    Unknown
    System.dll!System.IO.Compression.GZipStream.BeginRead(byte[] array, int offset, int count, System.AsyncCallback asyncCallback, object asyncState)   Unknown
    System.dll!System.Net.GZipWrapperStream.BeginRead(byte[] buffer, int offset, int size, System.AsyncCallback callback, object state) Unknown
    PriceSvc.dll!ns.Price.ClientGetAsync.ReadCallBack(System.IAsyncResult asyncResult) Line 699 C#
    System.dll!System.IO.Compression.DeflateStream.BeginRead(byte[] array, int offset, int count, System.AsyncCallback asyncCallback, object asyncState)    Unknown
    System.dll!System.IO.Compression.GZipStream.BeginRead(byte[] array, int offset, int count, System.AsyncCallback asyncCallback, object asyncState)   Unknown
    System.dll!System.Net.GZipWrapperStream.BeginRead(byte[] buffer, int offset, int size, System.AsyncCallback callback, object state) Unknown
    PriceSvc.dll!ns.Price.ClientGetAsync.ReadCallBack(System.IAsyncResult asyncResult) Line 699 C#
    System.dll!System.IO.Compression.DeflateStream.BeginRead(byte[] array, int offset, int count, System.AsyncCallback asyncCallback, object asyncState)    Unknown
    System.dll!System.IO.Compression.GZipStream.BeginRead(byte[] array, int offset, int count, System.AsyncCallback asyncCallback, object asyncState)   Unknown
    System.dll!System.Net.GZipWrapperStream.BeginRead(byte[] buffer, int offset, int size, System.AsyncCallback callback, object state) Unknown
    PriceSvc.dll!ns.Price.ClientGetAsync.ReadCallBack(System.IAsyncResult asyncResult) Line 699 C#
    System.dll!System.IO.Compression.DeflateStream.BeginRead(byte[] array, int offset, int count, System.AsyncCallback asyncCallback, object asyncState)    Unknown
    System.dll!System.IO.Compression.GZipStream.BeginRead(byte[] array, int offset, int count, System.AsyncCallback asyncCallback, object asyncState)   Unknown
    System.dll!System.Net.GZipWrapperStream.BeginRead(byte[] buffer, int offset, int size, System.AsyncCallback callback, object state) Unknown
    PriceSvc.dll!ns.Price.ClientGetAsync.ReadCallBack(System.IAsyncResult asyncResult) Line 699 C#
    System.dll!System.IO.Compression.DeflateStream.BeginRead(byte[] array, int offset, int count, System.AsyncCallback asyncCallback, object asyncState)    Unknown
    System.dll!System.IO.Compression.GZipStream.BeginRead(byte[] array, int offset, int count, System.AsyncCallback asyncCallback, object asyncState)   Unknown
    System.dll!System.Net.GZipWrapperStream.BeginRead(byte[] buffer, int offset, int size, System.AsyncCallback callback, object state) Unknown
    PriceSvc.dll!ns.Price.ClientGetAsync.ReadCallBack(System.IAsyncResult asyncResult) Line 699 C#
    System.dll!System.IO.Compression.DeflateStream.BeginRead(byte[] array, int offset, int count, System.AsyncCallback asyncCallback, object asyncState)    Unknown
    System.dll!System.IO.Compression.GZipStream.BeginRead(byte[] array, int offset, int count, System.AsyncCallback asyncCallback, object asyncState)   Unknown
    System.dll!System.Net.GZipWrapperStream.BeginRead(byte[] buffer, int offset, int size, System.AsyncCallback callback, object state) Unknown
    PriceSvc.dll!ns.Price.ClientGetAsync.ReadCallBack(System.IAsyncResult asyncResult) Line 699 C#
    System.dll!System.IO.Compression.DeflateStream.BeginRead(byte[] array, int offset, int count, System.AsyncCallback asyncCallback, object asyncState)    Unknown
    System.dll!System.IO.Compression.GZipStream.BeginRead(byte[] array, int offset, int count, System.AsyncCallback asyncCallback, object asyncState)   Unknown
    System.dll!System.Net.GZipWrapperStream.BeginRead(byte[] buffer, int offset, int size, System.AsyncCallback callback, object state) Unknown
    PriceSvc.dll!ns.Price.ClientGetAsync.ReadCallBack(System.IAsyncResult asyncResult) Line 699 C#
    System.dll!System.IO.Compression.DeflateStream.BeginRead(byte[] array, int offset, int count, System.AsyncCallback asyncCallback, object asyncState)    Unknown
    System.dll!System.IO.Compression.GZipStream.BeginRead(byte[] array, int offset, int count, System.AsyncCallback asyncCallback, object asyncState)   Unknown
    System.dll!System.Net.GZipWrapperStream.BeginRead(byte[] buffer, int offset, int size, System.AsyncCallback callback, object state) Unknown
    PriceSvc.dll!ns.Price.ClientGetAsync.ReadCallBack(System.IAsyncResult asyncResult) Line 699 C#
    System.dll!System.IO.Compression.DeflateStream.BeginRead(byte[] array, int offset, int count, System.AsyncCallback asyncCallback, object asyncState)    Unknown
    System.dll!System.IO.Compression.GZipStream.BeginRead(byte[] array, int offset, int count, System.AsyncCallback asyncCallback, object asyncState)   Unknown
    System.dll!System.Net.GZipWrapperStream.BeginRead(byte[] buffer, int offset, int size, System.AsyncCallback callback, object state) Unknown
    PriceSvc.dll!ns.Price.ClientGetAsync.ReadCallBack(System.IAsyncResult asyncResult) Line 699 C#
    System.dll!System.IO.Compression.DeflateStream.BeginRead(byte[] array, int offset, int count, System.AsyncCallback asyncCallback, object asyncState)    Unknown
    System.dll!System.IO.Compression.GZipStream.BeginRead(byte[] array, int offset, int count, System.AsyncCallback asyncCallback, object asyncState)   Unknown
    System.dll!System.Net.GZipWrapperStream.BeginRead(byte[] buffer, int offset, int size, System.AsyncCallback callback, object state) Unknown
    PriceSvc.dll!ns.Price.ClientGetAsync.ReadCallBack(System.IAsyncResult asyncResult) Line 699 C#
    System.dll!System.IO.Compression.DeflateStream.BeginRead(byte[] array, int offset, int count, System.AsyncCallback asyncCallback, object asyncState)    Unknown
    System.dll!System.IO.Compression.GZipStream.BeginRead(byte[] array, int offset, int count, System.AsyncCallback asyncCallback, object asyncState)   Unknown
    System.dll!System.Net.GZipWrapperStream.BeginRead(byte[] buffer, int offset, int size, System.AsyncCallback callback, object state) Unknown
    PriceSvc.dll!ns.Price.ClientGetAsync.ReadCallBack(System.IAsyncResult asyncResult) Line 699 C#
    System.dll!System.IO.Compression.DeflateStream.BeginRead(byte[] array, int offset, int count, System.AsyncCallback asyncCallback, object asyncState)    Unknown
    System.dll!System.IO.Compression.GZipStream.BeginRead(byte[] array, int offset, int count, System.AsyncCallback asyncCallback, object asyncState)   Unknown
    System.dll!System.Net.GZipWrapperStream.BeginRead(byte[] buffer, int offset, int size, System.AsyncCallback callback, object state) Unknown
    PriceSvc.dll!ns.Price.ClientGetAsync.ReadCallBack(System.IAsyncResult asyncResult) Line 699 C#
    System.dll!System.IO.Compression.DeflateStream.BeginRead(byte[] array, int offset, int count, System.AsyncCallback asyncCallback, object asyncState)    Unknown
    System.dll!System.IO.Compression.GZipStream.BeginRead(byte[] array, int offset, int count, System.AsyncCallback asyncCallback, object asyncState)   Unknown
    System.dll!System.Net.GZipWrapperStream.BeginRead(byte[] buffer, int offset, int size, System.AsyncCallback callback, object state) Unknown
    PriceSvc.dll!ns.Price.ClientGetAsync.ReadCallBack(System.IAsyncResult asyncResult) Line 699 C#
    System.dll!System.IO.Compression.DeflateStream.BeginRead(byte[] array, int offset, int count, System.AsyncCallback asyncCallback, object asyncState)    Unknown
    System.dll!System.IO.Compression.GZipStream.BeginRead(byte[] array, int offset, int count, System.AsyncCallback asyncCallback, object asyncState)   Unknown
    System.dll!System.Net.GZipWrapperStream.BeginRead(byte[] buffer, int offset, int size, System.AsyncCallback callback, object state) Unknown
    PriceSvc.dll!ns.Price.ClientGetAsync.ReadCallBack(System.IAsyncResult asyncResult) Line 699 C#
    System.dll!System.IO.Compression.DeflateStream.BeginRead(byte[] array, int offset, int count, System.AsyncCallback asyncCallback, object asyncState)    Unknown
    System.dll!System.IO.Compression.GZipStream.BeginRead(byte[] array, int offset, int count, System.AsyncCallback asyncCallback, object asyncState)   Unknown
    System.dll!System.Net.GZipWrapperStream.BeginRead(byte[] buffer, int offset, int size, System.AsyncCallback callback, object state) Unknown
    PriceSvc.dll!ns.Price.ClientGetAsync.ReadCallBack(System.IAsyncResult asyncResult) Line 699 C#
    System.dll!System.IO.Compression.DeflateStream.BeginRead(byte[] array, int offset, int count, System.AsyncCallback asyncCallback, object asyncState)    Unknown
    System.dll!System.IO.Compression.GZipStream.BeginRead(byte[] array, int offset, int count, System.AsyncCallback asyncCallback, object asyncState)   Unknown
    System.dll!System.Net.GZipWrapperStream.BeginRead(byte[] buffer, int offset, int size, System.AsyncCallback callback, object state) Unknown
    PriceSvc.dll!ns.Price.ClientGetAsync.ReadCallBack(System.IAsyncResult asyncResult) Line 699 C#
    System.dll!System.IO.Compression.DeflateStream.BeginRead(byte[] array, int offset, int count, System.AsyncCallback asyncCallback, object asyncState)    Unknown
    System.dll!System.IO.Compression.GZipStream.BeginRead(byte[] array, int offset, int count, System.AsyncCallback asyncCallback, object asyncState)   Unknown
    System.dll!System.Net.GZipWrapperStream.BeginRead(byte[] buffer, int offset, int size, System.AsyncCallback callback, object state) Unknown
    PriceSvc.dll!ns.Price.ClientGetAsync.ReadCallBack(System.IAsyncResult asyncResult) Line 699 C#
    System.dll!System.IO.Compression.DeflateStream.BeginRead(byte[] array, int offset, int count, System.AsyncCallback asyncCallback, object asyncState)    Unknown
    System.dll!System.IO.Compression.GZipStream.BeginRead(byte[] array, int offset, int count, System.AsyncCallback asyncCallback, object asyncState)   Unknown
    System.dll!System.Net.GZipWrapperStream.BeginRead(byte[] buffer, int offset, int size, System.AsyncCallback callback, object state) Unknown
    PriceSvc.dll!ns.Price.ClientGetAsync.ReadCallBack(System.IAsyncResult asyncResult) Line 699 C#
    System.dll!System.IO.Compression.DeflateStream.BeginRead(byte[] array, int offset, int count, System.AsyncCallback asyncCallback, object asyncState)    Unknown
    System.dll!System.IO.Compression.GZipStream.BeginRead(byte[] array, int offset, int count, System.AsyncCallback asyncCallback, object asyncState)   Unknown
    System.dll!System.Net.GZipWrapperStream.BeginRead(byte[] buffer, int offset, int size, System.AsyncCallback callback, object state) Unknown
    PriceSvc.dll!ns.Price.ClientGetAsync.ReadCallBack(System.IAsyncResult asyncResult) Line 699 C#
    System.dll!System.IO.Compression.DeflateStream.BeginRead(byte[] array, int offset, int count, System.AsyncCallback asyncCallback, object asyncState)    Unknown
    System.dll!System.IO.Compression.GZipStream.BeginRead(byte[] array, int offset, int count, System.AsyncCallback asyncCallback, object asyncState)   Unknown
    System.dll!System.Net.GZipWrapperStream.BeginRead(byte[] buffer, int offset, int size, System.AsyncCallback callback, object state) Unknown
    PriceSvc.dll!ns.Price.ClientGetAsync.ReadCallBack(System.IAsyncResult asyncResult) Line 699 C#
    System.dll!System.IO.Compression.DeflateStream.BeginRead(byte[] array, int offset, int count, System.AsyncCallback asyncCallback, object asyncState)    Unknown
    System.dll!System.IO.Compression.GZipStream.BeginRead(byte[] array, int offset, int count, System.AsyncCallback asyncCallback, object asyncState)   Unknown
    System.dll!System.Net.GZipWrapperStream.BeginRead(byte[] buffer, int offset, int size, System.AsyncCallback callback, object state) Unknown
    PriceSvc.dll!ns.Price.ClientGetAsync.ReadCallBack(System.IAsyncResult asyncResult) Line 699 C#
    System.dll!System.IO.Compression.DeflateStream.BeginRead(byte[] array, int offset, int count, System.AsyncCallback asyncCallback, object asyncState)    Unknown
    System.dll!System.IO.Compression.GZipStream.BeginRead(byte[] array, int offset, int count, System.AsyncCallback asyncCallback, object asyncState)   Unknown
    System.dll!System.Net.GZipWrapperStream.BeginRead(byte[] buffer, int offset, int size, System.AsyncCallback callback, object state) Unknown
    PriceSvc.dll!ns.Price.ClientGetAsync.ReadCallBack(System.IAsyncResult asyncResult) Line 699 C#
    System.dll!System.IO.Compression.DeflateStream.BeginRead(byte[] array, int offset, int count, System.AsyncCallback asyncCallback, object asyncState)    Unknown
    System.dll!System.IO.Compression.GZipStream.BeginRead(byte[] array, int offset, int count, System.AsyncCallback asyncCallback, object asyncState)   Unknown
    System.dll!System.Net.GZipWrapperStream.BeginRead(byte[] buffer, int offset, int size, System.AsyncCallback callback, object state) Unknown
    PriceSvc.dll!ns.Price.ClientGetAsync.ReadCallBack(System.IAsyncResult asyncResult) Line 699 C#
    System.dll!System.IO.Compression.DeflateStream.ReadCallback(System.IAsyncResult baseStreamResult)   Unknown
    System.dll!System.Net.LazyAsyncResult.Complete(System.IntPtr userToken) Unknown
    System.dll!System.Net.ContextAwareResult.CaptureOrComplete(ref System.Threading.ExecutionContext cachedContext, bool returnContext) Unknown
    System.dll!System.Net.ContextAwareResult.FinishPostingAsyncOp(ref System.Net.CallbackClosure closure)   Unknown
    System.dll!System.Net.Sockets.Socket.BeginReceive(byte[] buffer, int offset, int size, System.Net.Sockets.SocketFlags socketFlags, out System.Net.Sockets.SocketError errorCode, System.AsyncCallback callback, object state)   Unknown
    System.dll!System.Net.Sockets.NetworkStream.BeginRead(byte[] buffer, int offset, int size, System.AsyncCallback callback, object state) Unknown
    System.dll!System.Net.PooledStream.BeginRead(byte[] buffer, int offset, int size, System.AsyncCallback callback, object state)  Unknown
    System.dll!System.Net.ConnectStream.BeginReadWithoutValidation(byte[] buffer, int offset, int size, System.AsyncCallback callback, object state)    Unknown
    System.dll!System.Net.ConnectStream.BeginRead(byte[] buffer, int offset, int size, System.AsyncCallback callback, object state) Unknown
    System.dll!System.IO.Compression.DeflateStream.ReadCallback(System.IAsyncResult baseStreamResult)   Unknown
    System.dll!System.Net.LazyAsyncResult.Complete(System.IntPtr userToken) Unknown
    mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)   Unknown
    mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)   Unknown
    mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) Unknown
    System.dll!System.Net.ContextAwareResult.Complete(System.IntPtr userToken)  Unknown
    System.dll!System.Net.Sockets.BaseOverlappedAsyncResult.CompletionPortCallback(uint errorCode, uint numBytes, System.Threading.NativeOverlapped* nativeOverlapped)  Unknown
    mscorlib.dll!System.Threading._IOCompletionCallback.PerformIOCompletionCallback(uint errorCode, uint numBytes, System.Threading.NativeOverlapped* pOVERLAP) Unknown
    [Native to Managed Transition]  
    

    My initial questions:

  • Are there inherent problems running 3.5 apps in a 4.5 app pool? This issue does not repro when debugging using VS2008 with a 3.5 runtime.
  • Is this symptomatic of a known issue (decompressing non-gzipped data or length mismatch?)... Seeing BeginReadWithoutValidation does not inspire confidence.
  • I realize this is vague so please let me know what kind of details I can add.

    I suppose PriceSvc.dll is your service? Could you try to find the line that calls GZipWrapperStream.BeginRead? Specifically, what is the size of the buffer? – Kevin Gosse Apr 12, 2017 at 18:55 The GZip calls are happening under the covers inside the .NET framework itself through the use of AutomaticDecompression. I am going through all the little differences in our dev and test environments, now. – Kris Oye Apr 12, 2017 at 19:00 I suspect the issue is with ClientGetAsync.ReadCallBack. You're calling BeginRead inside again and again until the end of the stream, blowing up the stack. There's a way to detect when BeginRead executed synchronously to avoid that, but to be honest I'm not too good with Begin/End APIs so I'm not sure what is the proper way to write this code. Ideally, since you're now targeting .NET 4.5, you could use the ReadAsync method instead, it will handle the logic for you. If there's no ReadAsync, you can use Task.Factory.FromAsync instead – Kevin Gosse Apr 12, 2017 at 19:23

    Thanks for contributing an answer to Stack Overflow!

    • Please be sure to answer the question. Provide details and share your research!

    But avoid

    • Asking for help, clarification, or responding to other answers.
    • Making statements based on opinion; back them up with references or personal experience.

    To learn more, see our tips on writing great answers.