Skip to content

Mono do not quit on receiving SIGQUIT #125733

@mrek-msft

Description

@mrek-msft

Description

It is behavioral difference between CoreCLR and Mono on Linux.

Reproduction Steps

Run infinite sleep loop:

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:

"<unnamed thread>"  at <unknown> <0xffffffff>
  at (wrapper managed-to-native) Interop/Sys.<LowLevelMonitor_TimedWait>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) <Module>.runtime_invoke_void_object (object,intptr,intptr,intptr) [0x00036] in <dc9d3b7433954b82bafe45efc672bea0>:0

"<unnamed thread>"
"Finalizer"

Regression?

No response

Known Workarounds

No response

Configuration

No response

Other information

It is not clear which behavior is correct, according to man 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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions