Bug 33534 - WriteZStream crashes in native code
Summary: WriteZStream crashes in native code
Status: RESOLVED FIXED
Alias: None
Product: Class Libraries
Classification: Mono
Component: System ()
Version: 4.0.0
Hardware: PC Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: João Matos
URL:
Depends on:
Blocks:
 
Reported: 2015-09-01 08:47 UTC by henrik
Modified: 2016-05-09 08:57 UTC (History)
3 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 2015-09-01 08:47:58 UTC
Stacktrace:

  at <unknown> <0xffffffff>
  at (wrapper managed-to-native) System.IO.Compression.DeflateStreamNative.WriteZStream (intptr,intptr,int) <IL 0x0002f, 0xffffffff>
  at System.IO.Compression.DeflateStreamNative.WriteZStream (intptr,int) [0x00000] in /private/tmp/source-mono-mac-4.0.0-branch-c5sr3/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.3/mcs/class/System/System.IO.Compression/DeflateStream.cs:379
  at System.IO.Compression.DeflateStream.WriteInternal (byte[],int,int) [0x0002e] in /private/tmp/source-mono-mac-4.0.0-branch-c5sr3/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.3/mcs/class/System/System.IO.Compression/DeflateStream.cs:153
  at (wrapper runtime-invoke) <Module>.runtime_invoke_void__this___object_int_int (object,intptr,intptr,intptr) <IL 0x00078, 0xffffffff>

Native stacktrace:


Debug info from gdb:

W 2015-09-01T12:41:00.8190220+00:00: tcp request processing failed [Suave.Tcp.tcpIpServer.job] cont...
System.NullReferenceException: Object reference not set to an instance of an object
  at (wrapper managed-to-native) System.IO.Compression.DeflateStreamNative:CloseZStream (intptr)
  at System.IO.Compression.DeflateStreamNative.Dispose (Boolean disposing) [0x00047] in /private/tmp/source-mono-mac-4.0.0-branch-c5sr3/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.3/mcs/class/System/System.IO.Compression/DeflateStream.cs:356
  at System.IO.Compression.DeflateStream.Dispose (Boolean disposing) [0x00000] in /private/tmp/source-mono-mac-4.0.0-branch-c5sr3/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.3/mcs/class/System/System.IO.Compression/DeflateStream.cs:100
  at System.IO.Stream.Close () [0x00000] in /private/tmp/source-mono-mac-4.0.0-branch-c5sr3/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.3/external/referencesource/mscorlib/system/io/stream.cs:248
  at System.IO.Stream.Dispose () [0x00000] in /private/tmp/source-mono-mac-4.0.0-branch-c5sr3/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.3/external/referencesource/mscorlib/system/io/stream.cs:260
  at (wrapper remoting-invoke-with-check) System.IO.Stream:Dispose ()
  at System.IO.Compression.GZipStream.Dispose (Boolean disposing) [0x00011] in /private/tmp/source-mono-mac-4.0.0-branch-c5sr3/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.3/mcs/class/System/System.IO.Compression/GZipStream.cs:66
  at System.IO.Stream.Close () [0x00000] in /private/tmp/source-mono-mac-4.0.0-branch-c5sr3/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.3/external/referencesource/mscorlib/system/io/stream.cs:248
  at System.IO.Stream.Dispose () [0x00000] in /private/tmp/source-mono-mac-4.0.0-branch-c5sr3/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/mono-4.0.3/external/referencesource/mscorlib/system/io/stream.cs:260
  at Microsoft.FSharp.Control.AsyncBuilderImpl+usingA@869[System.IO.Compression.GZipStream].Invoke (Microsoft.FSharp.Core.Unit unitVar0) [0x00000] in /private/tmp/source-mono-mac-4.0.0-branch-c5sr3/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/fsharp-fsharp-1f79c04/src/fsharp/FSharp.Core/control.fs:869
  at Microsoft.FSharp.Control.AsyncBuilderImpl+econt@830[Microsoft.FSharp.Core.FSharpChoice`2[Microsoft.FSharp.Core.Unit,Suave.Sockets.Error]].Invoke (System.Exception exn) [0x00000] in /private/tmp/source-mono-mac-4.0.0-branch-c5sr3/bockbuild-mono-4.0.0-branch/profiles/mono-mac-xamarin/build-root/fsharp-fsharp-1f79c04/src/fsharp/FSharp.Core/control.fs:830
V 2015-09-01T12:41:00.8200340+00:00: 127.0.0.1 disconnected, total: 0 clients [Suave.Tcp.tcpIpServer.job]

It seems that first exception causes an invalid state that causes the second exception.

Repro https://github.com/haf/suave-presentation.2015-09-03/commit/22a3ba2640551ad86a1d868f6ca52486d8f08dcc by running it on OS X, installing paket packages and then `./site.fsx` and then `curl http://localhost:8083/`.
Comment 1 henrik 2015-09-01 09:42:38 UTC
Sometimes I get it together

V 2015-09-01T13:42:09.5359920+00:00: Files.browse trying file (local file url:'/js/index.js' root:'/Users/h/dev/haf/suave-presentation.2015-09-03/build/public/') [Suave.Http.Files.browse]
Stacktrace:

  at <unknown> <0xffffffff>
  at (wrapper managed-to-native) System.IO.Compression.DeflateStreamNative.WriteZStream (intptr,intptr,int) <0xffffffff>
  at System.IO.Compression.DeflateStreamNative.WriteZStream (intptr,int) <0x00023>
  at System.IO.Compression.DeflateStream.WriteInternal (byte[],int,int) <0x00057>
  at (wrapper runtime-invoke) <Module>.runtime_invoke_void__this___object_int_int (object,intptr,intptr,intptr) <0xffffffff>

Native stacktrace:


Debug info from gdb:

W 2015-09-01T13:42:09.5602840+00:00: tcp request processing failed [Suave.Tcp.tcpIpServer.job] cont...
System.MissingMethodException: Method 'FSharpAsync.AwaitTask' not found.
  at Microsoft.FSharp.Control.AsyncBuilderImpl+callA@805[Microsoft.FSharp.Core.FSharpChoice`2[Microsoft.FSharp.Core.Unit,Suave.Sockets.Error],Microsoft.FSharp.Core.Unit].Invoke (Microsoft.FSharp.Control.AsyncParams`1 args) [0x00000] in <filename unknown>:0
V 2015-09-01T13:42:09.5613820+00:00: 127.0.0.1 disconnected, total: 0 clients [Suave.Tcp.tcpIpServer.job]
/tmp/mono-gdb-commands.2PkuRp:1: Error in sourced command file:
Unable to find Mach task port for process-id 10151: (os/kern) failure (0x5).
 (please check gdb is codesigned - see taskgated(8))

=================================================================
Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
=================================================================
Comment 2 henrik 2015-09-01 09:43:34 UTC
Last comment was on mono 4.0.4 beta

mono --version
Mono JIT compiler version 4.0.4 ((detached/5ab4c0d Tue Aug 25 08:35:07 EDT 2015)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
	TLS:           normal
	SIGSEGV:       altstack
	Notification:  kqueue
	Architecture:  x86
	Disabled:      none
	Misc:          softdebug
	LLVM:          yes(3.6.0svn-mono-(detached/a173357)
	GC:            sgen
Comment 3 henrik 2015-09-01 09:50:26 UTC
Repro commit, more extensive:


 1. d/l code base
 2. pushd public && npm install && popd
 3. mono paket.bootstrapper.exe
 4. mono paket.exe install
 5. ./site.fsx
Comment 4 João Matos 2016-02-22 15:05:25 UTC
Is this still an issue with latest Mono versions?
Comment 5 João Matos 2016-02-24 14:46:20 UTC
I'm not being able to follow the reproduction steps, NPM is failing:

npm ERR! peerinvalid The package react does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer material-ui@0.11.1 wants react@>=0.13
npm ERR! peerinvalid Peer react-router@0.13.5 wants react@0.13.x||0.14.x
npm ERR! peerinvalid Peer react-tap-event-plugin@0.1.8 wants react@^0.14.0-0 || ~0.13.x || ~0.12.x
npm ERR! peerinvalid Peer rx-react@0.2.1 wants react@~0.13.0
npm ERR! peerinvalid Peer react-dom@0.14.7 wants react@^0.14.7
Comment 6 henrik 2016-05-09 08:57:05 UTC
Replaced with https://bugzilla.xamarin.com/show_bug.cgi?id=40862