You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Mono does not emit ProcessExit event on SIGTERM. #81093
changed the title [-]'dotnet run' behaves different on SIGTERM with Mono compared to CoreCLR[/-][+]Mono does not emit ProcessExit event on SIGTERM.[/+]on Feb 1, 2023
Activity
akoeplinger commentedon Jan 24, 2023
Hmm it feels more like a dotnet/runtime issue to me given this is a difference between Mono and CoreCLR. Should I move the issue?
tmds commentedon Jan 24, 2023
I was not sure where to create it. It does look like the ASP.NET app responds to SIGTERM appropriately.
You can move it to another repo if you prefer.
akoeplinger commentedon Jan 24, 2023
@lambdageek do you know which area we should assign this to?
lambdageek commentedon Jan 24, 2023
@akoeplinger not sure. AppModel, maybe? Cc @vitek-karas
It will probably come back to mono, but it's not obvious to me why the behavior difference.
jkotas commentedon Jan 24, 2023
It is most likely an issue with Mono-specific SIGTERM handler.
jkotas commentedon Jan 24, 2023
Potential duplicate of #31656
tmds commentedon Feb 1, 2023
I've debugged this issue. Mono doesn't install a signal handler for
SIGTERMto emit theAppDomain.CurrentDomain.ProcessExitevent.CoreCLR installs it here:
runtime/src/coreclr/pal/src/exception/signal.cpp
Line 236 in 9e05d33
This event is used by the cli to reap the child processes using its ProcessReaper class.
A simpler reproducer for the issue is:
If you send
SIGTERMto this app, with CoreCLR you'll see the message get printed, and with Mono you don't.[-]'dotnet run' behaves different on SIGTERM with Mono compared to CoreCLR[/-][+]Mono does not emit ProcessExit event on SIGTERM.[/+]tmds commentedon Feb 1, 2023
Yes, it is the same root cause. The
SigTermExitCodetest depends onProcessExitbeing emitted onSIGTERM.tmds commentedon Feb 3, 2023
SIGTERMworks for the ASP.NET/Generic host because it moved from theProcessExitevent to thePosixSignalAPI in .NET 6.lambdageek commentedon Feb 3, 2023
attn @SamMonoRT
15 remaining items
nealef commentedon Feb 24, 2023
The
HelloWorldprocess is exiting with the correct value:An
straceshows all the processes exiting with the desired value:I changed the
HelloWorldprogram to do:And ran things again and this time looked at all the threads:
The
straceshowed:So I think it's doing what it should. Should I generate a PR?
akoeplinger commentedon Feb 24, 2023
The VBCSCompiler sticking around is expected, it's the Roslyn compiler server: https://github.com/dotnet/roslyn/blob/main/docs/compilers/Compiler%20Server.md.
This is probably because you use
dotnet runwhich does a build first. If you launch the app directly it shouldn't happen.tmds commentedon Feb 28, 2023
@nealef definitely!
Provide fix for dotnet#81093
Provide fix for dotnet#81093 - "Mono does not emit ProcessExit event …
SamMonoRT commentedon Jul 31, 2023
@nealef - your PR addresses the issue, should we close this one ?
nealef commentedon Aug 1, 2023
SamMonoRT commentedon Aug 11, 2023
Moving this to the 9.0.0 milestone. If the fix is trivial and non-risky we will consider backport to 8.0 build prior to release.
Provide fix for dotnet#81093 - "Mono does not emit ProcessExit event …
Provide fix for #81093 - "Mono does not emit ProcessExit event on SIG…