Skip to content

Commit f21eb18

Browse files
rcj1Rachel Jarvi
andauthored
Adding proper exiting and cleanup logic for singlefile createdump (#117286)
* adding proper exiting and cleanup logic for singlefile createdump * simplifying code change --------- Co-authored-by: Rachel Jarvi <[email protected]>
1 parent 645d049 commit f21eb18

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/coreclr/pal/src/thread/process.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2239,6 +2239,7 @@ PROCCreateCrashDump(
22392239
else if (childpid == 0)
22402240
{
22412241
// Close the read end of the pipe, the child doesn't need it
2242+
int callbackResult = 0;
22422243
close(parent_pipe);
22432244

22442245
// Only dup the child's stderr if there is error buffer
@@ -2252,7 +2253,12 @@ PROCCreateCrashDump(
22522253
SEHCleanupSignals(true /* isChildProcess */);
22532254

22542255
// Call the statically linked createdump code
2255-
g_createdumpCallback(argv.size(), argv.data());
2256+
callbackResult = g_createdumpCallback(argv.size(), argv.data());
2257+
// Set the shutdown callback to nullptr and exit
2258+
// If we don't exit, the child's execution will continue into the diagnostic server behavior
2259+
// which causes all sorts of problems.
2260+
g_shutdownCallback = nullptr;
2261+
exit(callbackResult);
22562262
}
22572263
else
22582264
{

0 commit comments

Comments
 (0)