Stream: git-wasmtime

Topic: wasmtime / PR #12542 Limit the number of frames in backtr...


view this post on Zulip Wasmtime GitHub notifications bot (Feb 09 2026 at 15:23):

adambratschikaye opened PR #12542 from adambratschikaye:abk/limit-backtrace-size to bytecodealliance:main:

Add Config::wasm_backtrace_max_frames option to limit the number of frames collected in backtraces and set the default at 20. This helps prevent expensive work from very deep call stacks.

Setting the value to 0 is the same as disabling backtraces and so this change deprecates Config::wasm_backtrace.

Addresses https://github.com/bytecodealliance/wasmtime/issues/5052

<!--
Please make sure you include the following information:

Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.html

Please ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->

view this post on Zulip Wasmtime GitHub notifications bot (Feb 09 2026 at 15:23):

adambratschikaye requested fitzgen for a review on PR #12542.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 09 2026 at 15:23):

adambratschikaye requested wasmtime-core-reviewers for a review on PR #12542.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 09 2026 at 17:03):

github-actions[bot] added the label wasmtime:config on PR #12542.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 09 2026 at 17:03):

github-actions[bot] added the label wasmtime:api on PR #12542.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 09 2026 at 17:18):

fitzgen submitted PR review:

Thanks! A couple nitpicks inline below before we merge this.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 09 2026 at 17:18):

fitzgen created PR review comment:

(Also, we could avoid the NonZeroUsize::new(...).unwrap() noise here by making the DEFAULT_WASM_BACKTRACE_MAX_FRAMES constant be a NonZeroUsize already.)

view this post on Zulip Wasmtime GitHub notifications bot (Feb 09 2026 at 17:18):

fitzgen created PR review comment:

Can we represent this as an Option<NonZeroUsize>? That will make use sites clearer, rather than checking for zero.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 09 2026 at 17:18):

fitzgen created PR review comment:

Minor nitpick, but I think the logic is a little more clear when collapsing the nested conditionals into a single match:

        match (enable, self.wasm_backtrace_max_frames) {
            (false, _) => self.wasm_backtrace_max_frames = None,

            // Wasm backtraces were disabled; enable them with the
            // default maximum number of frames to capture.
            (true, None) => self.wasm_backtrace_max_frames = {
                Some(NonZeroUsize::new(DEFAULT_WASM_BACKTRACE_MAX_FRAMES).unwrap());
            }

            // Wasm backtraces are already enabled; keep the existing
            // max-frames configuration.
            (true, Some(_)) => {}
        }

view this post on Zulip Wasmtime GitHub notifications bot (Feb 09 2026 at 18:00):

github-actions[bot] commented on PR #12542:

Label Messager: wasmtime:config

It looks like you are changing Wasmtime's configuration options. Make sure to
complete this check list:

[fuzzing-config]: https://github.com/bytecodealliance/wasmtime/blob/ca0e8d0a1d8cefc0496dba2f77a670571d8fdcab/crates/fuzzing/src/generators.rs#L182-L194
[fuzzing-docs]: https://docs.wasmtime.dev/contributing-fuzzing.html


<details>

To modify this label's message, edit the <code>.github/label-messager/wasmtime-config.md</code> file.

To add new label messages or remove existing label messages, edit the
<code>.github/label-messager.json</code> configuration file.

Learn more.

</details>

view this post on Zulip Wasmtime GitHub notifications bot (Feb 09 2026 at 18:08):

venkkatesh-sekar submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 09 2026 at 18:08):

venkkatesh-sekar created PR review comment:

        let mut wasm_trace = Vec::<FrameInfo>::with_capacity(max_frames);

view this post on Zulip Wasmtime GitHub notifications bot (Feb 10 2026 at 08:19):

adambratschikaye updated PR #12542.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 10 2026 at 08:40):

adambratschikaye updated PR #12542.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 10 2026 at 08:43):

adambratschikaye updated PR #12542.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 10 2026 at 08:43):

adambratschikaye requested fitzgen for a review on PR #12542.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 10 2026 at 08:43):

adambratschikaye requested venkkatesh-sekar for a review on PR #12542.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 10 2026 at 08:45):

adambratschikaye commented on PR #12542:

Regarding the note on fuzzing - I guess we don't need to do anything because fuzzing always used the default of enabling backtraces and that isn't changing.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 10 2026 at 09:01):

adambratschikaye updated PR #12542.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 10 2026 at 09:14):

venkkatesh-sekar submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 10 2026 at 17:49):

fitzgen submitted PR review:

Thanks!

view this post on Zulip Wasmtime GitHub notifications bot (Feb 10 2026 at 17:50):

fitzgen added PR #12542 Limit the number of frames in backtrace collection to the merge queue.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 10 2026 at 18:13):

github-merge-queue[bot] removed PR #12542 Limit the number of frames in backtrace collection from the merge queue.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 16 2026 at 16:12):

adambratschikaye requested alexcrichton for a review on PR #12542.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 16 2026 at 16:12):

adambratschikaye requested wasmtime-fuzz-reviewers for a review on PR #12542.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 16 2026 at 16:12):

adambratschikaye updated PR #12542.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 16 2026 at 16:13):

adambratschikaye commented on PR #12542:

@fitzgen Looks like there was a fuzz testing failure and a docs failure when merging. They should be fixed now.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 16 2026 at 16:13):

adambratschikaye requested fitzgen for a review on PR #12542.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 16 2026 at 17:55):

github-actions[bot] added the label fuzzing on PR #12542.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 16 2026 at 17:56):

github-actions[bot] commented on PR #12542:

Subscribe to Label Action

cc @fitzgen

<details>
This issue or pull request has been labeled: "fuzzing", "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 <code>.github/subscribe-to-label.json</code> configuration file.

Learn more.
</details>

view this post on Zulip Wasmtime GitHub notifications bot (Feb 17 2026 at 18:21):

fitzgen submitted PR review:

Thanks! Just one more small thing before we land this. Thanks for your patience!

view this post on Zulip Wasmtime GitHub notifications bot (Feb 17 2026 at 18:21):

fitzgen created PR review comment:

Rather than hard-coding a second copy of the default, which means this test will start failing if we ever change the default, can we explicitly set a limit and rely on that in the test here? Even better would be to generate an arbitrary limit as part of the wasmtime_fuzzing::generators::Stacks struct, so we fuzz different stack trace limits as well.

Should just require adding a pub limit: Option<NonZeroUsize>, field here:

https://github.com/bytecodealliance/wasmtime/blob/f6418005cd282f32840483709c448cf2e8ac808a/crates/fuzzing/src/generators/stacks.rs#L17-L23

And then adding something like let limit = NonZeroUsize::new(u.int_in_range(0..=256)?); inside here:

https://github.com/bytecodealliance/wasmtime/blob/f6418005cd282f32840483709c448cf2e8ac808a/crates/fuzzing/src/generators/stacks.rs#L40-L47

And finally creating the config with the limit and an engine from that config inside this current function, rather than using a default config and default engine:

let mut config = Config::new();
config.wasm_backtrace_max_frames(stacks.limit);
let engine = Engine::new(&config)?;

view this post on Zulip Wasmtime GitHub notifications bot (Feb 18 2026 at 08:15):

adambratschikaye updated PR #12542.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 18 2026 at 08:16):

adambratschikaye submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 18 2026 at 08:16):

adambratschikaye created PR review comment:

No problem, I made those changes.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 18 2026 at 08:16):

adambratschikaye requested fitzgen for a review on PR #12542.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 18 2026 at 15:49):

fitzgen submitted PR review:

Thanks!

view this post on Zulip Wasmtime GitHub notifications bot (Feb 18 2026 at 15:49):

fitzgen added PR #12542 Limit the number of frames in backtrace collection to the merge queue.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 18 2026 at 16:22):

fitzgen merged PR #12542.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 18 2026 at 16:22):

fitzgen removed PR #12542 Limit the number of frames in backtrace collection from the merge queue.

view this post on Zulip Wasmtime GitHub notifications bot (Feb 20 2026 at 10:10):

adambratschikaye commented on PR #12542:

Thanks @fitzgen


Last updated: Feb 24 2026 at 04:36 UTC