dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
15.36k stars 4.74k forks source link

exe file name gets truncated in .NET core mini dump name #83419

Open MichaelMaio opened 1 year ago

MichaelMaio commented 1 year ago

We’re collecting mini dumps for our .NET Core app as described here: Collect Dumps on Crash - .NET | Microsoft Learn. We’re setting DOTNET_DbgMiniDumpName to \%e.%d.dmp.

On Windows, everything works fine. For example, when I crash an app named DotNetCoreConsoleApp.exe, I get a dump named DotNetCoreConsoleApp.exe..dmp.

On Linux, however, the exe file name (the %e) is getting truncated to 15 characters. For example, I get a dump named DotNetCoreConso..dmp.

I've pasted a discussion this below with more information:

From: Juan Sebastian Hoyos Ayala Juan.Hoyos@microsoft.com Sent: Tuesday, March 14, 2023 11:52 AM To: Michael Maio michma@microsoft.com; Mike McLaughlin mikem@microsoft.com; Lee Culver leculver@microsoft.com Subject: RE: exe file name gets truncated in .NET core mini dump name

Or rather, on the systems that truncate it, it’s 16 chars. There’s other nodes in procfs too, but they lie easily about the proc name.

From: Juan Sebastian Hoyos Ayala Sent: Tuesday, March 14, 2023 11:51 AM To: Michael Maio [michma@microsoft.com](mailto:michma@microsoft.com); Mike McLaughlin [mikem@microsoft.com](mailto:mikem@microsoft.com); Lee Culver [leculver@microsoft.com](mailto:leculver@microsoft.com) Subject: RE: exe file name gets truncated in .NET core mini dump name

Sure, feel free to. It’s always truncated to 15 chars (the buffer they use internally is 16 chars).

From: Michael Maio [michma@microsoft.com](mailto:michma@microsoft.com) Sent: Tuesday, March 14, 2023 11:42 AM To: Juan Sebastian Hoyos Ayala [Juan.Hoyos@microsoft.com](mailto:Juan.Hoyos@microsoft.com); Mike McLaughlin [mikem@microsoft.com](mailto:mikem@microsoft.com); Lee Culver [leculver@microsoft.com](mailto:leculver@microsoft.com) Subject: RE: exe file name gets truncated in .NET core mini dump name

Should I log a bug on this? If so, where?

For now I guess we can work around it by truncating the name of the process when we look for its dump.

Thanks,

michma

From: Juan Sebastian Hoyos Ayala [Juan.Hoyos@microsoft.com](mailto:Juan.Hoyos@microsoft.com) Sent: Tuesday, March 14, 2023 10:19 AM To: Mike McLaughlin [mikem@microsoft.com](mailto:mikem@microsoft.com); Lee Culver [leculver@microsoft.com](mailto:leculver@microsoft.com); Michael Maio [michma@microsoft.com](mailto:michma@microsoft.com) Subject: Re: exe file name gets truncated in .NET core mini dump name

Given this has to be out of process, we should try to check for /proc/pod/exe. There's getauxval(AT_EXECFN), but likely can only be called in proc. There's also an aux file in proc with a pointer to the string, but that requires a remote read of a string. I feel the exe with fallback to status might be a better idea.

Juan


From: Mike McLaughlin [mikem@microsoft.com](mailto:mikem@microsoft.com) Sent: Tuesday, March 14, 2023 9:42:15 AM To: Lee Culver [leculver@microsoft.com](mailto:leculver@microsoft.com); Michael Maio [michma@microsoft.com](mailto:michma@microsoft.com) Cc: Juan Sebastian Hoyos Ayala [Juan.Hoyos@microsoft.com](mailto:Juan.Hoyos@microsoft.com) Subject: RE: exe file name gets truncated in .NET core mini dump name

Createdump gets the app name for %e on Linux from the /proc//status file. It parses the “Name: “ field. The name isn’t truncated by createdump so the limitation is status file’s Name field. If there is a better way to get the program name, we can change createdump to do that.

mikem

From: Lee Culver [leculver@microsoft.com](mailto:leculver@microsoft.com) Sent: Monday, March 13, 2023 9:25 PM To: Michael Maio [michma@microsoft.com](mailto:michma@microsoft.com); Mike McLaughlin [mikem@microsoft.com](mailto:mikem@microsoft.com) Subject: RE: exe file name gets truncated in .NET core mini dump name

Mike was OOF today, I’m sure he’ll respond when he’s back this week.

-Lee

From: Michael Maio [michma@microsoft.com](mailto:michma@microsoft.com) Sent: Monday, March 13, 2023 8:34 PM To: Lee Culver [leculver@microsoft.com](mailto:leculver@microsoft.com); Mike McLaughlin [mikem@microsoft.com](mailto:mikem@microsoft.com) Subject: RE: exe file name gets truncated in .NET core mini dump name

@Mike McLaughlin, do you know if this is a known issue in .NET core dump generation?

Thanks,

michma

From: Lee Culver [leculver@microsoft.com](mailto:leculver@microsoft.com) Sent: Saturday, March 11, 2023 9:28 AM To: Michael Maio [michma@microsoft.com](mailto:michma@microsoft.com); NET Core Discussion [netcoredisc@microsoft.com](mailto:netcoredisc@microsoft.com); Mike McLaughlin [mikem@microsoft.com](mailto:mikem@microsoft.com) Subject: RE: exe file name gets truncated in .NET core mini dump name

@Mike McLaughlin would be the expert here.

Thanks, -Lee Culver CLR Technical Insights

From: Michael Maio [michma@microsoft.com](mailto:michma@microsoft.com) Sent: Friday, March 10, 2023 9:01 PM To: NET Core Discussion [netcoredisc@microsoft.com](mailto:netcoredisc@microsoft.com) Subject: exe file name gets truncated in .NET core mini dump name

We’re collecting mini dumps for our .NET Core app as described here: Collect Dumps on Crash - .NET | Microsoft Learn. We’re setting DOTNET_DbgMiniDumpName to \%e.%d.dmp.

On Windows, everything works fine. For example, when I crash an app named DotNetCoreConsoleApp.exe, I get a dump named DotNetCoreConsoleApp.exe..dmp.

On Linux, however, the exe file name (the %e) is getting truncated to 15 characters. For example, I get a dump named DotNetCoreConso..dmp.

Is this a known bug? Any work-arounds? We’re using .NET Core 7. I haven’t checked if it also repros on Mac yet.

Thanks,

michma

ghost commented 1 year ago

Tagging subscribers to this area: @tommcdon See info in area-owners.md if you want to be subscribed.

Issue Details
We’re collecting mini dumps for our .NET Core app as described here: [Collect Dumps on Crash - .NET | Microsoft Learn](https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Flearn.microsoft.com%2Fen-us%2Fdotnet%2Fcore%2Fdiagnostics%2Fcollect-dumps-crash&data=05%7C01%7Cmichma%40microsoft.com%7C8f58d8e72138419f089208db24bd32f4%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C638144167241836212%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=rzzHgDZgKwKx83McwLidiFSVy9MLMacV98utZ8KTKqc%3D&reserved=0). We’re setting DOTNET_DbgMiniDumpName to \%e.%d.dmp. On Windows, everything works fine. For example, when I crash an app named DotNetCoreConsoleApp.exe, I get a dump named DotNetCoreConsoleApp.exe..dmp. On Linux, however, the exe file name (the %e) is getting truncated to 15 characters. For example, I get a dump named DotNetCoreConso..dmp. I've pasted a discussion this below with more information: From: Juan Sebastian Hoyos Ayala Sent: Tuesday, March 14, 2023 11:52 AM To: Michael Maio ; Mike McLaughlin ; Lee Culver Subject: RE: exe file name gets truncated in .NET core mini dump name Or rather, on the systems that truncate it, it’s 16 chars. There’s other nodes in procfs too, but they lie easily about the proc name. From: Juan Sebastian Hoyos Ayala Sent: Tuesday, March 14, 2023 11:51 AM To: Michael Maio <[michma@microsoft.com](mailto:michma@microsoft.com)>; Mike McLaughlin <[mikem@microsoft.com](mailto:mikem@microsoft.com)>; Lee Culver <[leculver@microsoft.com](mailto:leculver@microsoft.com)> Subject: RE: exe file name gets truncated in .NET core mini dump name Sure, feel free to. It’s always truncated to 15 chars (the buffer they use internally is 16 chars). From: Michael Maio <[michma@microsoft.com](mailto:michma@microsoft.com)> Sent: Tuesday, March 14, 2023 11:42 AM To: Juan Sebastian Hoyos Ayala <[Juan.Hoyos@microsoft.com](mailto:Juan.Hoyos@microsoft.com)>; Mike McLaughlin <[mikem@microsoft.com](mailto:mikem@microsoft.com)>; Lee Culver <[leculver@microsoft.com](mailto:leculver@microsoft.com)> Subject: RE: exe file name gets truncated in .NET core mini dump name Should I log a bug on this? If so, where? For now I guess we can work around it by truncating the name of the process when we look for its dump. Thanks, michma From: Juan Sebastian Hoyos Ayala <[Juan.Hoyos@microsoft.com](mailto:Juan.Hoyos@microsoft.com)> Sent: Tuesday, March 14, 2023 10:19 AM To: Mike McLaughlin <[mikem@microsoft.com](mailto:mikem@microsoft.com)>; Lee Culver <[leculver@microsoft.com](mailto:leculver@microsoft.com)>; Michael Maio <[michma@microsoft.com](mailto:michma@microsoft.com)> Subject: Re: exe file name gets truncated in .NET core mini dump name Given this has to be out of process, we should try to check for /proc/pod/exe. There's getauxval(AT_EXECFN), but likely can only be called in proc. There's also an aux file in proc with a pointer to the string, but that requires a remote read of a string. I feel the exe with fallback to status might be a better idea. Juan ________________________________________ From: Mike McLaughlin <[mikem@microsoft.com](mailto:mikem@microsoft.com)> Sent: Tuesday, March 14, 2023 9:42:15 AM To: Lee Culver <[leculver@microsoft.com](mailto:leculver@microsoft.com)>; Michael Maio <[michma@microsoft.com](mailto:michma@microsoft.com)> Cc: Juan Sebastian Hoyos Ayala <[Juan.Hoyos@microsoft.com](mailto:Juan.Hoyos@microsoft.com)> Subject: RE: exe file name gets truncated in .NET core mini dump name Createdump gets the app name for %e on Linux from the /proc//status file. It parses the “Name: “ field. The name isn’t truncated by createdump so the limitation is status file’s Name field. If there is a better way to get the program name, we can change createdump to do that. mikem From: Lee Culver <[leculver@microsoft.com](mailto:leculver@microsoft.com)> Sent: Monday, March 13, 2023 9:25 PM To: Michael Maio <[michma@microsoft.com](mailto:michma@microsoft.com)>; Mike McLaughlin <[mikem@microsoft.com](mailto:mikem@microsoft.com)> Subject: RE: exe file name gets truncated in .NET core mini dump name Mike was OOF today, I’m sure he’ll respond when he’s back this week. -Lee From: Michael Maio <[michma@microsoft.com](mailto:michma@microsoft.com)> Sent: Monday, March 13, 2023 8:34 PM To: Lee Culver <[leculver@microsoft.com](mailto:leculver@microsoft.com)>; Mike McLaughlin <[mikem@microsoft.com](mailto:mikem@microsoft.com)> Subject: RE: exe file name gets truncated in .NET core mini dump name [@Mike McLaughlin](mailto:mikem@microsoft.com), do you know if this is a known issue in .NET core dump generation? Thanks, michma From: Lee Culver <[leculver@microsoft.com](mailto:leculver@microsoft.com)> Sent: Saturday, March 11, 2023 9:28 AM To: Michael Maio <[michma@microsoft.com](mailto:michma@microsoft.com)>; NET Core Discussion <[netcoredisc@microsoft.com](mailto:netcoredisc@microsoft.com)>; Mike McLaughlin <[mikem@microsoft.com](mailto:mikem@microsoft.com)> Subject: RE: exe file name gets truncated in .NET core mini dump name [@Mike McLaughlin](mailto:mikem@microsoft.com) would be the expert here. Thanks, -Lee Culver CLR Technical Insights From: Michael Maio <[michma@microsoft.com](mailto:michma@microsoft.com)> Sent: Friday, March 10, 2023 9:01 PM To: NET Core Discussion <[netcoredisc@microsoft.com](mailto:netcoredisc@microsoft.com)> Subject: exe file name gets truncated in .NET core mini dump name We’re collecting mini dumps for our .NET Core app as described here: [Collect Dumps on Crash - .NET | Microsoft Learn](https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Flearn.microsoft.com%2Fen-us%2Fdotnet%2Fcore%2Fdiagnostics%2Fcollect-dumps-crash&data=05%7C01%7Cmichma%40microsoft.com%7C8f58d8e72138419f089208db24bd32f4%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C638144167241836212%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=rzzHgDZgKwKx83McwLidiFSVy9MLMacV98utZ8KTKqc%3D&reserved=0). We’re setting DOTNET_DbgMiniDumpName to \%e.%d.dmp. On Windows, everything works fine. For example, when I crash an app named DotNetCoreConsoleApp.exe, I get a dump named DotNetCoreConsoleApp.exe..dmp. On Linux, however, the exe file name (the %e) is getting truncated to 15 characters. For example, I get a dump named DotNetCoreConso..dmp. Is this a known bug? Any work-arounds? We’re using .NET Core 7. I haven’t checked if it also repros on Mac yet. Thanks, michma
Author: MichaelMaio
Assignees: -
Labels: `bug`, `area-Diagnostics-coreclr`
Milestone: -
tommcdon commented 9 months ago

There does not seem to be an actionable fix for this issue due to OS-level limitations. Moving to Future as a tracking issue.