Skip to content

Commit fcef7f9

Browse files
github-actions[bot]Copilotsteveisoknoahfalk
authored
[release/10.0] Defer DOTNET_DbgEnableMiniDump error message until dump creation (#126055)
Backport of #122986 to release/10.0 /cc @hoyosjs @Copilot ## Customer Impact - [x] Customer reported - [ ] Found internally If customers specify the crash dump collecting variables on nativeAOT, the default was to print error on startup to warn the user. It's also an issue since we've moved tools like crossgen to nativeAOT, and setting variables like this during build means child procs also prints the error message - even if no crash is going to happen. This defers the message - and while we are not proactive at letting the user know, it's a better user experience for many cases where native AOT is used. ## Regression - [ ] Yes - [x] No ## Testing Main has had this change for a while and is stable. ## Risk Low. Changes eliminate unnecessary file system checks during initialization and defer error detection to the point where the binary is actually needed (execv call). The actual dump creation logic and all success paths remain unchanged. Error messages now appear only when dumps are actually attempted, preventing spurious warnings during initialization. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: steveisok <471438+steveisok@users.noreply.github.com> Co-authored-by: noahfalk <6243776+noahfalk@users.noreply.github.com>
1 parent 7706f54 commit fcef7f9

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

src/coreclr/nativeaot/Runtime/unix/PalCreateDump.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,14 @@ CreateCrashDump(
271271
// Execute the createdump program
272272
if (execv(argv[0], (char* const *)argv) == -1)
273273
{
274-
fprintf(stderr, "Problem launching createdump (may not have execute permissions): execv(%s) FAILED %s (%d)\n", argv[0], strerror(errno), errno);
274+
if (errno == ENOENT)
275+
{
276+
fprintf(stderr, "DOTNET_DbgEnableMiniDump is set and the createdump binary does not exist: %s\n", argv[0]);
277+
}
278+
else
279+
{
280+
fprintf(stderr, "Problem launching createdump (may not have execute permissions): execv(%s) FAILED %s (%d)\n", argv[0], strerror(errno), errno);
281+
}
275282
exit(-1);
276283
}
277284
}
@@ -604,12 +611,6 @@ PalCreateDumpInitialize()
604611
}
605612
strncat(program, DumpGeneratorName, programLen);
606613

607-
struct stat fileData;
608-
if (stat(program, &fileData) == -1 || !S_ISREG(fileData.st_mode))
609-
{
610-
fprintf(stderr, "DOTNET_DbgEnableMiniDump is set and the createdump binary does not exist: %s\n", program);
611-
return true;
612-
}
613614
g_szCreateDumpPath = program;
614615

615616
// Format the app pid for the createdump command line

0 commit comments

Comments
 (0)