Skip to content

Can't fully disable wasm backtraces #4350

Description

@Stebalien
  • In wasmtime 0.38.1, disabling stack tracing results in a setting "unwind_info" is configured to Bool(false) which is not supported due to
    "unwind_info" => *value == FlagValue::Bool(true),
    .
  • On master, backtraces can be disabled, but cranelift's "unwind_info" isn't set to false (it just isn't set). This is making one of our tests 1000x slower (0.12 seconds to 120 seconds).

I can fix this with:

diff --git a/crates/wasmtime/src/config.rs b/crates/wasmtime/src/config.rs
index b41ae9396..256009a0a 100644
--- a/crates/wasmtime/src/config.rs
+++ b/crates/wasmtime/src/config.rs
@@ -1423,6 +1423,10 @@ impl Config {
             {
                 bail!("compiler option 'unwind_info' must be enabled when either 'backtraces' or 'reference types' are enabled");
             }
+        } else {
+            unsafe {
+                self.cranelift_flag_set("unwind_info", "false");
+            }
         }
         if self.features.reference_types {
             if !self
diff --git a/crates/wasmtime/src/engine.rs b/crates/wasmtime/src/engine.rs
index 9dd637e71..83514d72c 100644
--- a/crates/wasmtime/src/engine.rs
+++ b/crates/wasmtime/src/engine.rs
@@ -345,7 +345,7 @@ impl Engine {
             // can affect the way the generated code performs or behaves at
             // runtime.
             "avoid_div_traps" => *value == FlagValue::Bool(true),
-            "unwind_info" => *value == FlagValue::Bool(true),
+            "unwind_info" => true,
             "libcall_call_conv" => *value == FlagValue::Enum("isa_default".into()),
 
             // Features wasmtime doesn't use should all be disabled, since

But I'm wondering if:

  1. The other settings (reference types, simd) need to be explicitly set as well.
  2. There's a bad default somewhere. Should unwind_info be disabled by default in cranelift?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIncorrect behavior in the current implementation that needs fixing

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions