-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Report unhandled exceptions/FailFast in event log #98152
Conversation
Fixes dotnet#73998. `EventReporter` is basically taken from eventreporter.cpp in the VM.
Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas Issue DetailsFixes #73998.
Cc @tommcdon @mikem8361 @dotnet/ilc-contrib
|
_description.AppendLine("unknown"); | ||
} | ||
|
||
_description.Append("CoreCLR Version: "); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CoreCLR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CoreCLR?
Don't see a good enough reason to break people who parse this.
src/coreclr/nativeaot/System.Private.CoreLib/src/System/EventReporter.cs
Outdated
Show resolved
Hide resolved
if (exception != null && reason is not RhFailFastReason.AssertionFailure) | ||
{ | ||
reporter.AddDescription($"{exception.GetType()}: {exception.Message}"); | ||
reporter.AddStackTrace(exception.StackTrace); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Computing the stack trace is a complicated operation and it is likely to crash again when things are corrupted. The existing console printing code is written in a way so that there is at least something printed to the console in this case, giving people clue what might have happened.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved it after writing to console.
src/coreclr/vm/eventreporter.h
Outdated
// Maximum size for a string in event log entry | ||
#define MAX_SIZE_EVENTLOG_ENTRY_STRING 0x8000 // decimal 32768 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Maximum size for a string in event log entry | |
#define MAX_SIZE_EVENTLOG_ENTRY_STRING 0x8000 // decimal 32768 |
src/coreclr/vm/eventreporter.h
Outdated
// permissible length of the string and event header became 32K, resulting in strings becoming | ||
// shorter in length. Hence, the change in size. | ||
// An event entry comprises of string to be written and event header information. | ||
// The total permissible length of the string and event header is 32K. | ||
#define MAX_SIZE_EVENTLOG_ENTRY_STRING_WINVISTA 0x7C62 // decimal 31842 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#define MAX_SIZE_EVENTLOG_ENTRY_STRING_WINVISTA 0x7C62 // decimal 31842 | |
#define MAX_SIZE_EVENTLOG_ENTRY_STRING 0x7C62 // decimal 31842 |
const int MAX_SIZE_EVENTLOG_ENTRY_STRING_WINVISTA = 0x7C62; // decimal 31842 | ||
|
||
// Continue to append to the buffer until we are full | ||
if (!_bufferFull) | ||
{ | ||
_description.AppendLine(s); | ||
|
||
// Truncate the buffer if we have exceeded the limit based upon the OS we are on | ||
if (_description.Length > MAX_SIZE_EVENTLOG_ENTRY_STRING_WINVISTA) | ||
{ | ||
// Load the truncation message | ||
string truncate = "\nThe remainder of the message was truncated.\n"; | ||
|
||
int truncCount = truncate.Length; | ||
|
||
// Go back "truncCount" characters from the end of the string. | ||
int ext = MAX_SIZE_EVENTLOG_ENTRY_STRING_WINVISTA - truncCount; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const int MAX_SIZE_EVENTLOG_ENTRY_STRING_WINVISTA = 0x7C62; // decimal 31842 | |
// Continue to append to the buffer until we are full | |
if (!_bufferFull) | |
{ | |
_description.AppendLine(s); | |
// Truncate the buffer if we have exceeded the limit based upon the OS we are on | |
if (_description.Length > MAX_SIZE_EVENTLOG_ENTRY_STRING_WINVISTA) | |
{ | |
// Load the truncation message | |
string truncate = "\nThe remainder of the message was truncated.\n"; | |
int truncCount = truncate.Length; | |
// Go back "truncCount" characters from the end of the string. | |
int ext = MAX_SIZE_EVENTLOG_ENTRY_STRING_WINVISTA - truncCount; | |
const int MAX_SIZE_EVENTLOG_ENTRY_STRING = 0x7C62; // decimal 31842 | |
// Continue to append to the buffer until we are full | |
if (!_bufferFull) | |
{ | |
_description.AppendLine(s); | |
// Truncate the buffer if we have exceeded the limit based upon the OS we are on | |
if (_description.Length > MAX_SIZE_EVENTLOG_ENTRY_STRING) | |
{ | |
// Load the truncation message | |
string truncate = "\nThe remainder of the message was truncated.\n"; | |
int truncCount = truncate.Length; | |
// Go back "truncCount" characters from the end of the string. | |
int ext = MAX_SIZE_EVENTLOG_ENTRY_STRING - truncCount; |
cc @Hoyos @mikem8361 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
Fixes #73998.
EventReporter
is basically taken from eventreporter.cpp in the VM.Cc @tommcdon @mikem8361 @dotnet/ilc-contrib