-
Notifications
You must be signed in to change notification settings - Fork 480
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
Don't try to print stack trace if we're inside malloc #74
base: master
Are you sure you want to change the base?
Conversation
@@ -500,6 +500,7 @@ class StackTraceImpl { | |||
size_t load_from(void*, size_t=0) { return 0; } | |||
unsigned thread_id() const { return 0; } | |||
void skip_n_firsts(size_t) { } | |||
bool can_safely_backtrace() { return true; } |
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.
What about returning an enum { MAYBE, NO, DONTKNOW } ?
MAYBE: more yes than no, but we can never prove anything anyway.
NO: definitively not safe
DONTKNOW: didnt even try
I just ran into this exact issue today. One option to still have a nice backtrace (which, frankly is awesone: it changes how I develop), would be to have a static array of Just my 2c since I ran into this (I sat around forevre waiting for my process to finish only to fire up |
Sadly, the libraries used behind are using malloc like its free ;) So we
cannot easily workaround that unless we write a zero allocation dwarf
decoder... or patch the libraries.
…On Sat, Dec 2, 2017 at 2:28 PM travisdowns ***@***.***> wrote:
I just ran into this exact issue today. One option to still have a nice
backtrace (which, frankly is awesone: it changes how I develop), would be
to have a static array of char in backwards.cpp or in backwards itself
and use that to at least give a basic stack in this case. Admittedly that
is hard since new and malloc are deeply ingrained in C++ and so avoiding
new and malloc entirely can be hard (replacing the new operation for some
classes might help).
Just my 2c since I ran into this (I sat around forevre waiting for my
process to finish only to fire up gdb and find this stack above).
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#74 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AANMjMWmRzemqyD7gfMVuEgs487E8gLpks5s8c8egaJpZM4PauEG>
.
|
@bombela - yup, that's true, although note from the stack above that the stack was successfully taken, so at least those calls went through (but that could just be random, perhaps it simply happens they do few enough allocations that Probably just spitting out a message like "we handled this but are skipping the stack trace to avoid deadlock" is best. The call |
If signal handler is called inside
malloc
we might deadlock, issue #47Got this deadlock with jemalloc
This PR tries to avoid that by skipping backtrace output in such case.