Crash (Stackoverflow) on application exit - by Alois

Status : 

  Fixed<br /><br />
		This item has been fixed in the current or upcoming version of this product.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.

Sign in
to vote
ID 764933 Comments
Status Closed Workarounds
Type Bug Repros 0
Opened 9/27/2012 6:47:56 AM
Access Restriction Public


When a thread is in a wait state when the Main method is left but shortly before a thread.Interrupt was called on it it can happen that the other thread is causing a crash due to a bug in the error handling of the CLR. 

During the shutdown the CLR assumes that no thread does wake up anymore. But if the Finalizer thread is stuck this race conditon does surface. Since Thread.Interrupt is asynchronous the CLR thinks that after the Main method has been left that all threads are not running anymore. But the other Thread is waken up again from the Wait state at a time where important CLR structure seem to be already missing.

This does occur only with 4.0 (x64 and x86). On 3.5 and 4.5 I was not able to repro it. 

Sign in to post a comment.
Posted by Eric [MSFT] on 1/23/2013 at 9:49 AM
Thank you for reporting this. The stack overflow was due to an error in the CLR's wait logic, which caused it to honor Thread.Interrupt (and other signals) during shutdown, sending the thread into infinite recursion. As you have noted, this should not be the case in .NET 4.5, as we have fixed this bug. If this is a blocking issue for you, I would recommend upgrading to 4.5.

Thanks again,
Eric Eilebrecht
Posted by Helen [MSFT] on 9/28/2012 at 12:31 AM
Thanks for your feedback.

We are rerouting this issue to the appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.
Posted by Helen [MSFT] on 9/27/2012 at 6:50 AM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(