-
Notifications
You must be signed in to change notification settings - Fork 38
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
Update crash handler behavior to opt-in #484
Conversation
source/module.c
Outdated
@@ -804,6 +804,7 @@ static PyMethodDef s_module_methods[] = { | |||
|
|||
static const char s_module_name[] = "_awscrt"; | |||
PyDoc_STRVAR(s_module_doc, "C extension for binding AWS implementations of MQTT, HTTP, and friends"); | |||
AWS_STATIC_STRING_FROM_LITERAL(s_crash_handler_env_var, "AWS_CRT_ENABLE_CRASH_HANDLER"); |
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.
debatable: shorter name, similar to pre-existing "AWS_CRT_MEMORY_TRACING"?
AWS_STATIC_STRING_FROM_LITERAL(s_crash_handler_env_var, "AWS_CRT_ENABLE_CRASH_HANDLER"); | |
AWS_STATIC_STRING_FROM_LITERAL(s_crash_handler_env_var, "AWS_CRT_CRASH_HANDLER"); |
|
||
/* Don't report this memory when dumping possible leaks. */ | ||
struct aws_allocator *nontracing_allocator = aws_default_allocator(); | ||
|
||
struct aws_string *crash_handler_env = NULL; |
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.
Speaking of "AWS_CRT_MEMORY_TRACING", we have a hack so that it's always turned on when tests run. let's do the same thing and always turn on the crash handler
Co-authored-by: Michael Graeb <graebm@amazon.com>
Description of changes:
Our current crash handler unintentionally catches crashes from other Python libraries that utilize native code. The stacktrace dumped by the crash handler makes it look like our fault as it contains
PyInt_init
calls at the top of the stack trace. These calls, in reality, are simply function calls made to print the stack trace and printed asPyInt_init
in release mode. To address this, this PR alters the crash handler to be an opt-in feature, disabling its automatic registration. Users can enable the crash handler by setting an env variable.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.