-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Emit an error message if the runtime fails to initialize, instead of just silently aborting #116171
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
Conversation
…just silently aborting
|
Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas |
|
Is there an example of a standard library (glibc, Rust stdlib, etc.) that prints to stderr if it fails to initialize? Trying to figure out if this is standard practice. Both good and bad things can happen from this. |
|
I think libc calls |
It appears that would be pointless for release builds. |
|
This is the best I could think of to mimic a runtime initialization failure in C++: #include <stdexcept>
struct Global
{
Global()
{
throw std::runtime_error("Init failure");
}
};
Global g;
int main()
{
return 0;
}That results in the following printed to stderr: Default Termination Handler: |
jkotas
left a comment
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.
We do the same in front of other PalPrintFatalError, so this change is just going with the flow.
If we wanted to do something else, we should revisit all PalPrintFatalError+RhFailFast calls.
See #95257 and #7740 and the various issue reports related to them.