Bug 22346 - System.IO.IOException: Internal error (no progress possible) ReadInternal
Summary: System.IO.IOException: Internal error (no progress possible) ReadInternal
Status: RESOLVED FIXED
Alias: None
Product: Class Libraries
Classification: Mono
Component: System ()
Version: master
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: João Matos
URL:
: 26177 ()
Depends on:
Blocks:
 
Reported: 2014-08-25 16:15 UTC by henrik
Modified: 2015-01-21 07:14 UTC (History)
4 users (show)

Tags:
Is this bug a regression?: ---
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:
RESOLVED FIXED

Description henrik 2014-08-25 16:15:16 UTC
https://tc-oss.intelliplan.net/viewLog.html?buildId=451&buildTypeId=Suave_BuildIt&tab=buildLog

[19:45:02][Step 2/4] gzip_encode/gzip_decode-Falsifiable, after 2 tests (0 shrinks) (StdGen (521041651,295902581)):
[19:45:02][Step 2/4] ""
[19:45:02][Step 2/4] with exception:
[19:45:02][Step 2/4] System.IO.IOException: Internal error (no progress possible) ReadInternal
[19:45:02][Step 2/4] at System.IO.Compression.DeflateStreamNative.CheckResult (Int32 result, System.String where) [0x00000] in <filename unknown>:0
[19:45:02][Step 2/4] at System.IO.Compression.DeflateStreamNative.ReadZStream (IntPtr buffer, Int32 length) [0x00000] in <filename unknown>:0
[19:45:02][Step 2/4] at System.IO.Compression.DeflateStream.ReadInternal (System.Byte[] array, Int32 offset, Int32 count) [0x00000] in <filename unknown>:0
[19:45:03][Step 2/4] at System.IO.Compression.DeflateStream.Read (System.Byte[] dest, Int32 dest_offset, Int32 count) [0x00000] in <filename unknown>:0
[19:45:03][Step 2/4] at System.IO.Compression.GZipStream.Read (System.Byte[] dest, Int32 dest_offset, Int32 count) [0x00000] in <filename unknown>:0
[19:45:03][Step 2/4] at System.IO.Stream.CopyTo (System.IO.Stream destination, Int32 bufferSize) [0x00000] in <filename unknown>:0
[19:45:03][Step 2/4] at System.IO.Stream.CopyTo (System.IO.Stream destination) [0x00000] in <filename unknown>:0
[19:45:03][Step 2/4] at (wrapper remoting-invoke-with-check) System.IO.Stream:CopyTo (System.IO.Stream)
[19:45:03][Step 2/4] at Suave.Utils+Compression.gzip_decode (System.Byte[] bytes) [0x00000] in <filename unknown>:0
[19:45:03][Step 2/4] at Suave.Tests.Utils+utilities@19-2.Invoke (System.String str) [0x00000] in <filename unknown>:0
[19:45:03][Step 2/4] at FsCheck.Testable.evaluate[String,Unit] (Microsoft.FSharp.Core.FSharpFunc`2 body, System.String a) [0x00000] in <filename unknown>:0
[19:45:03][Step 2/4] 

Description:

When running integration tests with gzip from System.IO.Compression you get this error from C.

Expected results:

Code from C and its internal state machine should not trigger errors in consumer code. It works on Windows.

Steps to repro (sketch):

yum install mono fsharp
git clone https://github.com/SuaveIO/suave.git
cd suave
bundle
bundle exec rake
Comment 1 Pavel 2014-09-30 05:07:28 UTC
I also has similar bug when I'm trying to download one webbage http://nocopy.ru, although any other webpages download normally.
To reproduce the error you can run next code which works fine on native .NET Windows:


 var req = (HttpWebRequest)HttpWebRequest.Create("http://nocopy.ru");

            req.Headers.Add(HttpRequestHeader.AcceptLanguage, "ru,uk;q=0.8,en-US;q=0.6,en;q=0.4");
            req.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8";
            if (string.IsNullOrEmpty(req.UserAgent))
                req.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.114 Safari/537.36";
            req.Headers.Add(HttpRequestHeader.AcceptEncoding, "gzip,deflate");
            req.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate;

            using (var resp = req.GetResponse())
            {
                var stream = resp.GetResponseStream();

                StreamReader sr = new StreamReader(stream, System.Text.Encoding.UTF8);
                string resultHtml = sr.ReadToEnd();

                Console.WriteLine(resultHtml);
            }

On ubuntu linux (Mono 3.8) there is next exception:

Unhandled Exception:
System.IO.IOException: Internal error (no progress possible) ReadInternal
  at System.IO.Compression.DeflateStreamNative.CheckResult (Int32 result, System.String where) [0x00000] in <filename unknown>:0
  at System.IO.Compression.DeflateStreamNative.ReadZStream (IntPtr buffer, Int32 length) [0x00000] in <filename unknown>:0
  at System.IO.Compression.DeflateStream.ReadInternal (System.Byte[] array, Int32 offset, Int32 count) [0x00000] in <filename unknown>:0
  at System.IO.Compression.DeflateStream.Read (System.Byte[] dest, Int32 dest_offset, Int32 count) [0x00000] in <filename unknown>:0
  at System.IO.Compression.GZipStream.Read (System.Byte[] dest, Int32 dest_offset, Int32 count) [0x00000] in <filename unknown>:0
  at System.IO.StreamReader.ReadBuffer () [0x00000] in <filename unknown>:0
  at System.IO.StreamReader.ReadToEnd () [0x00000] in <filename unknown>:0
  at T.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.IO.IOException: Internal error (no progress possible) ReadInternal
  at System.IO.Compression.DeflateStreamNative.CheckResult (Int32 result, System.String where) [0x00000] in <filename unknown>:0
  at System.IO.Compression.DeflateStreamNative.ReadZStream (IntPtr buffer, Int32 length) [0x00000] in <filename unknown>:0
  at System.IO.Compression.DeflateStream.ReadInternal (System.Byte[] array, Int32 offset, Int32 count) [0x00000] in <filename unknown>:0
  at System.IO.Compression.DeflateStream.Read (System.Byte[] dest, Int32 dest_offset, Int32 count) [0x00000] in <filename unknown>:0
  at System.IO.Compression.GZipStream.Read (System.Byte[] dest, Int32 dest_offset, Int32 count) [0x00000] in <filename unknown>:0
  at System.IO.StreamReader.ReadBuffer () [0x00000] in <filename unknown>:0
  at System.IO.StreamReader.ReadToEnd () [0x00000] in <filename unknown>:0
  at T.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0
Comment 2 João Matos 2014-12-16 11:48:07 UTC
Didn't notice this bug before..

I've just tried this on OSX and can't reproduce it with a recent master.

Could you make sure this is still an issue with a recent Mono? Maybe it's Linux specific?
Comment 3 henrik 2014-12-16 11:50:07 UTC
It's a bug in how the library handles empty arrays. If there's nothing to decompress, this manifests. At least that was our problem.
Comment 4 João Matos 2014-12-16 12:09:05 UTC
I'm having some problems reproducing the steps you mentioned in the original report.


triton-mac:suave triton$ bundle exec rake
rake aborted!
LoadError: cannot load such file -- semver/semvermissingerror
/usr/local/lib/ruby/gems/2.1.0/gems/semver2-3.4.0/lib/xsemver.rb:2:in `require'
/usr/local/lib/ruby/gems/2.1.0/gems/semver2-3.4.0/lib/xsemver.rb:2:in `<top (required)>'
/usr/local/lib/ruby/gems/2.1.0/gems/albacore-2.2.0.pre.beta.7/lib/albacore/semver.rb:1:in `require'
/usr/local/lib/ruby/gems/2.1.0/gems/albacore-2.2.0.pre.beta.7/lib/albacore/semver.rb:1:in `<top (required)>'
/usr/local/lib/ruby/gems/2.1.0/gems/albacore-2.2.0.pre.beta.7/lib/albacore/project.rb:3:in `require'
/usr/local/lib/ruby/gems/2.1.0/gems/albacore-2.2.0.pre.beta.7/lib/albacore/project.rb:3:in `<top (required)>'
/usr/local/lib/ruby/gems/2.1.0/gems/albacore-2.2.0.pre.beta.7/lib/albacore/nuget_model.rb:5:in `require'
/usr/local/lib/ruby/gems/2.1.0/gems/albacore-2.2.0.pre.beta.7/lib/albacore/nuget_model.rb:5:in `<top (required)>'
/Users/triton/Development/suave/Rakefile:4:in `require'
/Users/triton/Development/suave/Rakefile:4:in `<top (required)>'
(See full trace by running task with --trace)


triton-mac:suave triton$ bundle
Using rake 10.3.2
Using map 6.5.5
Using mini_portile 0.6.0
Using nokogiri 1.6.3.1
Using semver2 3.4.0
Using albacore 2.2.0.pre.beta.7
Using bundler 1.7.9
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.


triton-mac:suave triton$ ruby -v
ruby 2.1.3p242 (2014-09-19 revision 47630) [x86_64-darwin12.0]


Is there an easier way to reproduce this? Unfortunately the test case from Pavel above doesn't trigger any crash under OSX.
Comment 5 henrik 2014-12-16 12:16:55 UTC
See the cd23dfcefda3b7034eabd3109255ca3fc52f4a7a commit of suave. That's when it was triggered.

That ruby error normally comes when you have puppet installed as a gem, too, or when you're mix-and-matching operating system gems with your own.

You can compile by opening the project in Xamarin Studio/MonoDevelop, restore packages, run the tests.exe-file.

Did you try handing the decompress method an empty array?
Comment 6 João Matos 2014-12-16 13:58:55 UTC
Thanks for your help, I was able to reproduce this manually with an empty array and it should be fixed in master.

https://github.com/mono/mono/commit/b5ddc30ebc05f4ac3ec0ab827b9d5bdecaacd368
Comment 7 João Matos 2015-01-21 07:14:16 UTC
*** Bug 26177 has been marked as a duplicate of this bug. ***