Mono do not quit on receiving SIGQUIT
- Dominant language
- C#
- Stars
- 18.3k
- Forks
- 5.6k
- PR merge metrics
- PR metrics pending
Description
### Description
It is behavioral difference between CoreCLR and Mono on Linux.
### Reproduction Steps
Run infinite sleep loop:
```csharp
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Threading;
namespace HelloWorld {
internal class Program {
private static void Main(string[] args) {
Console.WriteLine("PID: " + Process.GetCurrentProcess().Id.ToString());
while (true) {
Thread.Sleep(100);
}
}
}
}
```
And send SIGQUIT to it:
`kill -QUIT {PID}`
### Expected behavior
Process stops
### Actual behavior
Process prints following **and continues running**.
```
Full thread dump:
"" at <0xffffffff>
at (wrapper managed-to-native) Interop/Sys.g____PInvoke|65_0 (intptr,int) [0x00014] in <48deac90f77c40ecb460e0dfba2ffc9d>:0
at Interop/Sys.LowLevelMonitor_TimedWait (intptr,int) [0x00004] in <48deac90f77c40ecb460e0dfba2ffc9d>:0
at System.Threading.LowLevelMonitor.WaitCore (int) [0x0002e] in <48deac90f77c40ecb460e0dfba2ffc9d>:0
at System.Threading.LowLevelMonitor.Wait (int) [0x0001c] in <48deac90f77c40ecb460e0dfba2ffc9d>:0
at System.Threading.WaitSubsystem/ThreadWaitInfo.Wait (int,bool,bool,System.Threading.WaitSubsystem/LockHolder&) [0x00137] in <48deac90f77c40ecb460e0dfba2ffc9d>:0
at System.Threading.WaitSubsystem/ThreadWaitInfo.Sleep (int,bool) [0x00066] in <48deac90f77c40ecb460e0dfba2ffc9d>:0
at System.Threading.WaitSubsystem.Sleep (int,bool) [0x00003] in <48deac90f77c40ecb460e0dfba2ffc9d>:0
at System.Threading.Thread.SleepInternal (int) [0x00002] in <48deac90f77c40ecb460e0dfba2ffc9d>:0
at System.Threading.Thread.Sleep (int) [0x0000f] in <48deac90f77c40ecb460e0dfba2ffc9d>:0
at HelloWorld.Program.Main (string[]) [0x00026] in /home/mrek/runtime/src/mono/sample/HelloWorld/Program.cs:11
at (wrapper runtime-invoke) .runtime_invoke_void_object (object,intptr,intptr,intptr) [0x00036] in :0
""
"Finalizer"
```
### Regression?
_No response_
### Known Workarounds
_No response_
### Configuration
_No response_
### Other information
It is not clear which behavior is correct, according to [man](https://www.man7.org/linux/man-pages/man7/signal.7.html) for SIGQUIT
> _Default action is to **terminate the process** and dump core_
but it seems that one user in #104425 already requested bringing Mono (despite not mentioning it directly) behavior to CoreCLR. I think CoreCLR behavior is correct.
There is also issue #81093 and PR #100056 for SIGTERM. I suspect that changes from these PR should be implemented for SIGQUIT as well, but I did not tested or verified this hypothesis.
Contributor guide
Assessment
This issue has not been assessed yet.