-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create CoreCLR tests for verifying the stack overflow stack trace printing #32203
Comments
@janvorli For netcoreapp3.1, it used to get output:"Stack overflow" + returncode:0xC00000FD(stack overflow) when SOF without debugger, and output:"Stack overflow" + returncode:0xC0000005(access violation) when debugger is attached and SOF is happen outside main thread.
simple test code using System;
using System.Runtime.CompilerServices;
using System.Threading;
using System.Threading.Tasks;
namespace ConsoleApp2
{
internal class Program
{
private static void Main(string[] args)
{
switch (args.Length)
{
case 0:
Console.WriteLine("SOF in async");
SOFAsync().Wait();
break;
case 1:
Console.WriteLine("SOF in sync");
SOF();
break;
case 2:
Console.WriteLine("SOF in background");
new Thread(() => SOF()) { IsBackground = true }.Start();
Thread.Sleep(1000);
break;
case 3:
Console.WriteLine("SOF in thread pool");
ThreadPool.QueueUserWorkItem(state => SOF());
Thread.Sleep(1000);
break;
case 4:
Console.WriteLine("SOF in foreground");
new Thread(() => SOF()) { IsBackground = false }.Start();
Thread.Sleep(1000);
break;
default:
Console.WriteLine("Unknown mode: " + args.Length);
break;
}
}
private static async Task SOFAsync()
{
await Task.Delay(100);
SOF();
}
[MethodImpl(MethodImplOptions.NoInlining)]
private static void SOF()
{
SOF();
}
}
} |
@yyjdelete thank you for letting me know, I'll try your sample to see what's wrong. When I was testing it, I've tested stack overflow on both the main thread and also on many secondary threads. Both cases worked for me, generating a stack trace. |
@yyjdelete I've found what's wrong when running your test case. We get out of stack again when trying to walk the stack and dump the trace. It seems that the async machinery or something else in your change different from my test has made a difference that flipped it over the edge. |
The tests should verify that at stack overflow caused by both probing and real stack overflow from one or more threads at the same time prints expected stack trace.
The text was updated successfully, but these errors were encountered: