Bug 56260 - Possible regression: This stream does not support writing at System.IO.Compression.DeflateStream.BeginWrite
Summary: Possible regression: This stream does not support writing at System.IO.Comp...
Status: VERIFIED FIXED
Alias: None
Product: Class Libraries
Classification: Mono
Component: System ()
Version: 5.0 (2017-02)
Hardware: PC Mac OS
: High critical
Target Milestone: 15.2.2
Assignee: Martin Baulig
URL:
Depends on:
Blocks:
 
Reported: 2017-05-12 06:20 UTC by Tomas Jansson
Modified: 2017-05-20 21:57 UTC (History)
10 users (show)

Tags: 15.2R
Is this bug a regression?: Yes
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
VERIFIED FIXED

Description Tomas Jansson 2017-05-12 06:20:50 UTC
Using `FSharp.Data` and calling

    let response = Http.RequestString("http://www.twitter.com")

has worked fun up to 5.0. When I upgraded to 5.0.0.48 I got the following exception:

System.InvalidOperationException: This stream does not support writing
  at System.IO.Compression.DeflateStream.BeginWrite (System.Byte[] buffer, System.Int32 offset, System.Int32 count, Syst
em.AsyncCallback cback, System.Object state) [0x00021] in <ee4df4cda5014c96916f8e16adf2d907>:0
  at System.IO.Stream+<>c.<BeginEndWriteAsync>b__53_0 (System.IO.Stream stream, System.IO.Stream+ReadWriteParameters arg
s, System.AsyncCallback callback, System.Object state) [0x00000] in <164469fa6d844a078126fd8006807335>:0
  at System.Threading.Tasks.TaskFactory`1[TResult].FromAsyncTrim[TInstance,TArgs] (TInstance thisRef, TArgs args, System
.Func`5[T1,T2,T3,T4,TResult] beginMethod, System.Func`3[T1,T2,TResult] endMethod) [0x00008] in <164469fa6d844a078126fd80
06807335>:0
  at System.IO.Stream.BeginEndWriteAsync (System.Byte[] buffer, System.Int32 offset, System.Int32 count) [0x00000] in <1
64469fa6d844a078126fd8006807335>:0
  at System.IO.Stream.WriteAsync (System.Byte[] buffer, System.Int32 offset, System.Int32 count, System.Threading.Cancel
lationToken cancellationToken) [0x00009] in <164469fa6d844a078126fd8006807335>:0
  at System.IO.Compression.GZipStream.WriteAsync (System.Byte[] array, System.Int32 offset, System.Int32 count, System.T
hreading.CancellationToken cancellationToken) [0x00006] in <ee4df4cda5014c96916f8e16adf2d907>:0
  at System.IO.Compression.GZipStream.BeginRead (System.Byte[] array, System.Int32 offset, System.Int32 count, System.As
yncCallback asyncCallback, System.Object asyncState) [0x00009] in <ee4df4cda5014c96916f8e16adf2d907>:0
  at Microsoft.FSharp.Control.CommonExtensions+AsyncRead@2132.Invoke (System.Tuple`5[T1,T2,T3,T4,T5] tupledArg) [0x00025
] in <58e7b19fdff9fae1a74503839fb1e758>:0
  at <StartupCode$FSharp-Core>.$Control+FromBeginEnd@1895-4[TArg1,TArg2,TArg3].Invoke (System.Tuple`2[T1,T2] tupledArg)
[0x0002e] in <58e7b19fdff9fae1a74503839fb1e758>:0
  at <StartupCode$FSharp-Core>.$Control+FromBeginEnd@1834-1[T].Invoke (System.Threading.CancellationToken _arg4) [0x0005
c] in <58e7b19fdff9fae1a74503839fb1e758>:0
  at Microsoft.FSharp.Control.AsyncBuilderImpl+args@823-1[a,b].Invoke (a a) [0x00016] in <58e7b19fdff9fae1a74503839fb1e7
58>:0
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <164469fa6d844a078126fd8006807335>:0
  at Microsoft.FSharp.Control.AsyncBuilderImpl.commit[a] (Microsoft.FSharp.Control.AsyncBuilderImpl+AsyncImplResult`1[T]
 res) [0x0002d] in <58e7b19fdff9fae1a74503839fb1e758>:0
  at Microsoft.FSharp.Control.CancellationTokenOps.RunSynchronouslyInCurrentThread[a] (System.Threading.CancellationToke
n token, Microsoft.FSharp.Control.FSharpAsync`1[T] computation) [0x00029] in <58e7b19fdff9fae1a74503839fb1e758>:0
  at Microsoft.FSharp.Control.CancellationTokenOps.RunSynchronously[a] (System.Threading.CancellationToken token, Micros
oft.FSharp.Control.FSharpAsync`1[T] computation, Microsoft.FSharp.Core.FSharpOption`1[T] timeout) [0x00014] in <58e7b19f
dff9fae1a74503839fb1e758>:0
  at Microsoft.FSharp.Control.FSharpAsync.RunSynchronously[T] (Microsoft.FSharp.Control.FSharpAsync`1[T] computation, Mi
crosoft.FSharp.Core.FSharpOption`1[T] timeout, Microsoft.FSharp.Core.FSharpOption`1[T] cancellationToken) [0x00071] in <
58e7b19fdff9fae1a74503839fb1e758>:0
  at FSharp.Data.Http.RequestString (System.String url, Microsoft.FSharp.Core.FSharpOption`1[T] query, Microsoft.FSharp.
Core.FSharpOption`1[T] headers, Microsoft.FSharp.Core.FSharpOption`1[T] httpMethod, Microsoft.FSharp.Core.FSharpOption`1
[T] body, Microsoft.FSharp.Core.FSharpOption`1[T] cookies, Microsoft.FSharp.Core.FSharpOption`1[T] cookieContainer, Micr
osoft.FSharp.Core.FSharpOption`1[T] silentHttpErrors, Microsoft.FSharp.Core.FSharpOption`1[T] responseEncodingOverride,
Microsoft.FSharp.Core.FSharpOption`1[T] customizeHttpRequest, Microsoft.FSharp.Core.FSharpOption`1[T] timeout) [0x00019]
 in <57950ff10a968414a7450383f10f9557>:0
  at <StartupCode$FSI_0002>.$FSI_0002.main@ () [0x0005c] in <b3e6a19481014d0c9b3acd5495987309>:0
  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object
[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflectio
n.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00032] in <164469fa6d844a07812
6fd8006807335>:0
Stopped due to error

I also tried 5.0.0.94, but the bug was still there.

I've also registered this issue in the `FSharp.Data` repo, https://github.com/fsharp/FSharp.Data/issues/1053, but it seems like the issue is with mono.
Comment 1 Tomas Jansson 2017-05-12 06:38:42 UTC
Updated to 5.0.0.100 since that is supposed to be stable but the error is still there.
Comment 2 Martin Baulig 2017-05-12 15:05:04 UTC
1.) Download binaries from http://fsharp.github.io/FSharp.Data/
2.) Run this:

=====
$ fsharpi
> #r "./bin/FSharp.Data.dll";;
> open FSharp.Data;;
> let response = Http.RequestString("http://www.twitter.com");;
=====

Confirmed working with 5.2.0.98 and 5.3.0.361.

Does not work with 5.0.0.100.
Comment 3 Marek Safar 2017-05-12 15:16:38 UTC
The issue is actually in upstream CoreFX code. Relevant fix https://github.com/dotnet/corefx/commit/a6c7e23421701870c1eb855eae95e4605e5b04b3
Comment 4 Martin Baulig 2017-05-12 15:20:52 UTC
https://github.com/mono/mono/pull/4844
Comment 5 Martin Baulig 2017-05-12 15:22:45 UTC
The fix is already in 2017-04.
Comment 6 Martin Baulig 2017-05-12 19:44:23 UTC
Fixed.
Comment 7 Mateusz Lewko 2017-05-14 01:14:14 UTC
Sorry for asking this here, but where can I download version of mono (for Ubuntu) in which this bug has been fixed?
Comment 8 Saurabh Paunikar 2017-05-15 12:30:59 UTC
Verified on mono version 5.0.0.107 

After running 

let response = Http.RequestString("http://www.twitter.com");;

Got response as

 response : string =
  "<!DOCTYPE html>
<html lang="en" data-scribe-reduced-action-qu"+[312094 chars]


ScreenCast link: https://www.screencast.com/t/AldVPQfM71Rc
Comment 9 Luis Aguilera 2017-05-16 15:32:52 UTC
@mateusz we'll be releasing this fix, along with a few others, into the stable updater channel in the next few days.
Comment 10 Hermann Scharitzer 2017-05-17 12:37:47 UTC
It seems that I got bitten by this exact same bug.

Is there any workaround?
Right now this is a release blocker for us.
Comment 11 Hermann Scharitzer 2017-05-19 10:49:22 UTC
For anyone looking for a workaround: Disabling Deflate and GZip compression on the WebClient worked for me.
Comment 12 Mateusz Lewko 2017-05-20 21:57:34 UTC
@Luis Really looking forward to pushing this fix into the stable chanel as it's a deal breaker for me.