Skip to content

Different initialization fuel on Linux and macOS with CoW enabled #14331

Description

@wilfreddenton

I ran into a difference in initialization fuel on Wasmtime 48.0.2, using the same Wasm and engine settings on Linux and macOS.

This module just initializes five bytes of memory. There are no imports or start function:

(module
  (memory (export "memory") 1)
  (data (i32.const 0) "hello"))

With a 1,000,000-fuel budget, the GitHub Actions runners report:

Runner Fuel consumed
Ubuntu 24.04 / x86_64 0
macOS 26 / aarch64 16,385

With a 1,000-fuel budget, Linux succeeds and macOS traps with OutOfFuel.

Here's the test and engine configuration. I compile the module in memory, with fuel enabled and CoW left at its default of enabled.

Looking at the code, it seems CoW availability determines whether the generated initialization code runs and charges fuel. My use case depends on nodes running on different platforms producing the same results, including fuel usage and whether execution succeeds or runs out of fuel.

Is this an unintended consequence of moving initialization into compiled code? Would memory_init_cow(false) be the right temporary workaround? Possibly related to #14205.

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

    wasmtime:fuelWasmtime issues related to fuel consumption

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions