Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
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
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.
The runtime needs non-alertable wait during the shutdown in gc.c when waiting the finalizer thread.
This can be reproduced by calling Environment.Exit from a catch handler that just got a TAE.
I'm adding a workaround for this in ves_icall_System_Environment_Exit. It should be removed once this is fixed.
@kumpera how do I reproduce this bug? I have made the os-event alertable, but I need to check if that fixed it. See https://github.com/mono/mono/pull/4341
Ok, verifying this is going to be hard without explicitly modifying the runtime. I'm aware of only the gc cleanup code using mono_thread_info_wait_one_handle in non-alertable mode.
To use my scenario, you can use mono/tests/abort-cctor.cs.
You'll make the Environment.Exit (6) crash.
To do that, you need to break self aborts to respect static cctors.
This is a simple hack. In threads.c: mono_thread_set_interruption_requested, change the force_interrupt variable to be always false and enjoy the crash.
@kumpera I am confused: should it crash when setting the force_interrupt to FALSE, or should it not?
What I am witnessing is an assertion at https://github.com/mono/mono/blob/master/mono/metadata/gc.c#L1067 as it returns MONO_THREAD_INFO_WAIT_RET_ALERTED because of the self interrupt at https://github.com/mono/mono/blob/master/mono/metadata/threads.c#L4919
Oh! My bad!
If you change gc.c:1067 to use a non-aletable wait it should not crash with your PR.
I updated gc.c:1067 to be non-alertable, and I don't see the crash anymore. Marking as fixed.
This is fixed with https://github.com/mono/mono/pull/4347