Bug 11648 - Mono (master/60979ce) crashes on mono_jit_cleanup() after HttpWebRequest.GetRequestStream
Summary: Mono (master/60979ce) crashes on mono_jit_cleanup() after HttpWebRequest.GetR...
Alias: None
Product: Runtime
Classification: Mono
Component: GC ()
Version: unspecified
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2013-04-08 08:23 UTC by Dmitriy Pyalov
Modified: 2017-07-07 20:57 UTC (History)
7 users (show)

Is this bug a regression?: ---
Last known good build:

test.cpp (1.10 KB, text/plain)
2014-08-09 22:39 UTC, Dave May
test.cs (509 bytes, text/plain)
2014-08-09 22:40 UTC, Dave May

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:

Comment 2 Zoltan Varga 2013-04-09 11:54:09 UTC
mono_jit_cleanup () is the proper way to shut down the runtime. As a workaroud, you can avoid calling it.
Comment 3 Rodrigo Kumpera 2013-05-23 12:19:14 UTC
Can you provide a test case that shows the crash on regular mono?
Comment 4 Dmitriy Pyalov 2013-05-23 13:10:35 UTC
The attached test crashes on regular mono.
Comment 5 Andres G. Aragoneses 2013-11-16 11:43:24 UTC
Dmitriy, looks like you forgot to attach the file.
Comment 6 Dave May 2014-08-09 22:39:32 UTC
Created attachment 7643 [details]
Comment 7 Dave May 2014-08-09 22:40:06 UTC
Created attachment 7644 [details]
Comment 8 Dave May 2014-08-09 22:48:15 UTC
Attached simple (Linux C++) test.cpp and test.cs which calls HttpWebRequest.GetResponseStream(), and crashes upon mono_jit_cleanup(), which is assuredly related to the original bug report.

Skipping mono_jit_cleanup() per Zoltan's suggestion does work around the issue.

Crashes seem to segfault or fail assertion with mono_mutex_lock. Seems to be related to threading since errors opening '/proc/...' are output after the calling executable has exited.

Works fine running without embedding the Mono runtime. Happens on the latest Mono also.

Native stacktrace:

        /usr/lib/libmono-2.0.so.1(+0xb4935) [0x7f6ca601b935]
        /usr/lib/libmono-2.0.so.1(+0x10702f) [0x7f6ca606e02f]
        /usr/lib/libmono-2.0.so.1(+0x3a309) [0x7f6ca5fa1309]
        /lib/x86_64-linux-gnu/libpthread.so.0(+0xf8f0) [0x7f6ca594d8f0]
        /usr/lib/libmono-2.0.so.1(+0x1840fe) [0x7f6ca60eb0fe]
        /usr/lib/libmono-2.0.so.1(+0x1c3f86) [0x7f6ca612af86]
        /usr/lib/libmono-2.0.so.1(+0x1c035a) [0x7f6ca612735a]
        /usr/lib/libmono-2.0.so.1(+0x1ed5fa) [0x7f6ca61545fa]
        /usr/lib/libmono-2.0.so.1(+0x217d94) [0x7f6ca617ed94]
        /lib/x86_64-linux-gnu/libpthread.so.0(+0x80ca) [0x7f6ca59460ca]
        /lib/x86_64-linux-gnu/libc.so.6(clone+0x6d) [0x7f6ca4e5906d]

Debug info from gdb:

Bad call to mono_mutex_lock result 22
* Assertion at marshal.c:2377, condition `ret == 0' not met

(( linux-shell-prompt )) warning: unable to open /proc file '/proc/25287/status'
warning: unable to open /proc file '/proc/25287/status'
ptrace: No such process.
Comment 9 Zoltan Varga 2014-08-13 19:58:11 UTC
Can't reproduce this using the testcase. What mono version is this ?
Comment 10 Ludovic Henry 2017-07-07 20:57:02 UTC
If you can you still reproduce with latest mono version, please feel free to reopen this bug. Thank you.