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
Fix stacktraces on MacOS #59690
Fix stacktraces on MacOS #59690
Conversation
This is an automated comment for commit 2a79f56 with description of existing statuses. It's updated for the latest CI running ❌ Click here to open a full report in a separate page Successful checks
|
Previously ClickHouse binary natively compiled on MacOS was writing lot of errors like
whereas cross-compiled binary just had empty traces.
With this patch I was able to get stacktraces like this:
|
@@ -1,6 +1,10 @@ | |||
#include <libunwind.h> | |||
|
|||
#if defined(__APPLE__) | |||
int backtrace(void ** buffer, int size); | |||
#else | |||
int backtrace(void ** buffer, int size) | |||
{ | |||
return unw_backtrace(buffer, size); |
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.
Why exactly it doesn't work on Apple Macintosh OS X?
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.
Why unw_backtrace
doesn't work? I have no idea. I tried to use libunwind just from llvm's master - the result is the same. The only thing which bothers me - why LLDB can unwind stack while ClickHouse cannot. This was the motivation for this change.
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.
It is prohibitive on Linux with glibc.
glibc uses an idiotic implementation: - it locates a .so at runtime and does dlopen.
It also does not work on Musl.
But I thought that it could be acceptable on Mac.
9c7b8af
to
157b216
Compare
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Fix stack unwinding on MacOS. This closes #53653