-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Set compiler flag 'unwind_info' to false if specified in config #6547
Set compiler flag 'unwind_info' to false if specified in config #6547
Conversation
Subscribe to Label Actioncc @peterhuene
This issue or pull request has been labeled: "wasmtime:api", "wasmtime:config"
Thus the following users have been cc'd because of the following labels:
To subscribe or unsubscribe from this label, edit the |
Label Messager: wasmtime:configIt looks like you are changing Wasmtime's configuration options. Make sure to
To modify this label's message, edit the To add new label messages or remove existing label messages, edit the |
I think it might be important to make the Also, I think the existing error messages, about unwind info being necessary for profiling, might be misleading. On Linux, In short, I think we need to sort out exactly when native unwind info is actually necessary before reviewing this PR in detail, because I think the overall logic may not be right. |
Good points! I just mimicked the other unwind function, can we lift the conversation to #6541, or would you like a new issue, or continue here? I can make this PR a draft in the meantime. |
I think it makes sense to discuss when native unwind info is necessary separately from #6541, which is about native unwind info being slow. But I don't think we need to open a new issue for it; this PR is a fine place to sort out the details, in my opinion. I'm hoping both @bjorn3 and @fitzgen can give more context on what the native unwind info is actually used for. |
I tested locally, and we do indeed produce identical binaries, both with
A couple small corrections / refinements:
So with (1), the message saying native unwind info is required for profiling is probably a bit strong, but it also isn't not required. It is subtle, and emitting the unwind info in that case, even if it doesn't end up used by the profiler's exact configuration, doesn't hurt so I'd like to continue to emit native unwind info whenever profiling support is configured. Backing up a bit: the reason we enable native unwind info by default is to be good citizens of the platform and do our best to interoperate with external tooling (such as profilers or debuggers or whatever) that are usually expecting to see the platform's unwind info. We don't rely on it for correctness, which is why we can (modulo bugs) turn it off. I think the good-citizen angle is still well-motivated, so I don't want to change defaults here. |
|
f873d17
to
4086ea5
Compare
I might have missed some context reading over this, but how come the profiling strategy is consulted when determining whether to enable this? I know that jitdump/perfmap/guest don't use native unwinding information ( |
Ah, I must be operating on outdated information (just like the configuration code itself must have been) because I was under the impression that If not, then yeah, we can probably decouple profiling and native unwind info. |
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.
LGTM, modulo the new revelations around profiling. Thanks!
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.
Okay, I think we have consensus on the conditions where this setting is needed, and now just need to agree on implementation.
Hey @fitzgen, the description of Cranelift's
Does Wasmtime GC still require libunwind? I assumed the fast stack walking is used there now. I'm wondering if we should make this Cranelift setting default to "false" at some point. |
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.
I failed to submit one of my review comments, whoops?
That would break panic backtraces. The only way wasmtime can influence panic backtrace printing is by registering unwindinfo. It can't hook unwinding. |
@bjorn3 I'm confused. Do you mean it would break backtraces for cg-clif? For Wasmtime, as far as I understand:
If you mean that cg-clif requires this, I think it would be reasonable to require cg-clif to ensure that the unwind-info flag is enabled. As far as I understand I don't think this flag is required for handling panics in Wasmtime. Have I missed something? |
I mean in wasmtime. And there not the unwinding to propagate panics to the caller, but the unwinding to get a backtrace as printed to the user. Backtrace printing is entirely unaffected by catch_unwind. |
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.
Great, I think this is all set. Thank you!
That is correct, we no longer require libunwind since the fast stack walking patches. Those docs are just outdated. |
CI says that this PR breaks fuzzing because I think these configs are never used for cross-compiling, so it should be good enough to use Assuming that's true, then the .native_unwind_info(self.wasmtime.native_unwind_info) with .native_unwind_info(cfg!(target_os = "windows") || self.wasmtime.native_unwind_info) |
That looks like the right fix to me 👍 |
@TimonPost would love to see this get merged, is there anything I can do to help? |
Good one, i'll patch it up, should be ready in a bit! |
238d075
to
3dff986
Compare
Rebased and updated the PR. @fitzgen can you review this? |
Subscribe to Label Actioncc @fitzgen
This issue or pull request has been labeled: "fuzzing"
Thus the following users have been cc'd because of the following labels:
To subscribe or unsubscribe from this label, edit the |
I'm not sure about the CI failures, but just figured I'd popin to say I'm using this patch with #6896 and it fixed some issues with C++ exceptions and wasmtime used in conjunction (there is a lock in libgcc that was having some contention issues). |
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.
This PR still looks good to me, thanks for fixing the Windows fuzzing issue!
The CI failure is probably because you accidentally changed crates/wasi-nn/spec
. I suspect you need to run git submodule update
to undo that, and then hopefully everything will be fine.
afbf49b
to
b910313
Compare
b910313
to
210e0f3
Compare
…codealliance#6547) * Set compiler flag 'unwind_info' to false if specified in config * fmt
Regarding issue #6541, it was reported that unloading a large module on macOS can result in significantly long loading times. One suggestion was to disable unwind frames, but this didn't seem to have any effect. Upon further investigation, it appears that this issue may be a regression introduced in a commit made last year in August. The specific commit can be found here: link to commit.
Currently, the config flag is enabled by default, and there is no option to turn it off via the
native_unwind_info
function. This pull request addresses the issue.I would like to have it confirmed if this means that all crane lift users have been forced to compile with unwind frames, always, or perhaps I am missing something.
Also, second question, disabling this flag, it would only affect GC tracing and debugging right? So should be fine to expose this to users if they use neither of those?
As temporary workaround i can do: