windmill-labs/windmill · error

clock_gettime is not supported

Error message

clock_gettime is not supported

What it means

`clock_gettime` is stubbed with a panic in the WASM Ruby parser because the sandbox provides no real-time clock through this libc export. Any VM or C code querying monotonic/real time via `clock_gettime` aborts. Time APIs must be provided by the host instead.

Source

Thrown at backend/parsers/windmill-parser-ruby/src/wasm_libc.rs:281

    _nmemb: usize,
    _stream: *mut c_void,
) -> usize {
    panic!("fwrite is not supported");
}

#[no_mangle]
pub unsafe extern "C" fn vsnprintf(
    _buf: *mut c_char,
    _size: usize,
    _format: *const c_char,
    _args: ...
) -> c_int {
    panic!("vsnprintf is not supported");
}

#[no_mangle]
pub extern "C" fn clock_gettime(ptr: usize, new_size: usize) {
    panic!("clock_gettime is not supported");
}

// int snprintf( char* restrict buffer, size_t bufsz, const char* restrict format, ... );
#[no_mangle]
pub extern "C" fn snprintf() {
    panic!("snprintf is not supported");
}

#[no_mangle]
pub extern "C" fn __assert_fail(_: *const i32, _: *const i32, _: *const i32, _: *const i32) {
    panic!("oh no");
}

View on GitHub (pinned to e474e8803c)

Solutions

  1. Remove time-measurement code from the Ruby code being parsed
  2. Obtain time from the host application and pass it in as data
  3. Wire the shim to WASI `clock_time_get` if timing inside the sandbox is required

Example fix

// before
elapsed = Time.now - start
// after
# compute timing on the host side; keep the parsed code time-free
Defensive patterns

Strategy: validation

Validate before calling

fn uses_time_calls(ruby_src: &str) -> bool {
    ["Time.now", "Process.clock_gettime", "Benchmark"].iter().any(|p| ruby_src.contains(p))
}

Try / catch

let result = std::panic::catch_unwind(|| parse_ruby(source));
if result.is_err() { return Err("parser sandbox does not support clock_gettime; pass time in as data".into()); }

Prevention

When it happens

Trigger: Calling the exported `clock_gettime` symbol, or Ruby code / VM internals measuring elapsed time via C `clock_gettime` during parse.

Common situations: Gems using timers, benchmarking, or timeout logic with C-level time calls executed inside the wasm parser.

Related errors


AI-assisted analysis of windmill-labs/windmill@e474e8803c (2026-09-03). Data as JSON: /api/errors/680d480af1846c00. Report an issue: GitHub.