windmill-labs/windmill · error

clock_gettime is not supported

Error message

clock_gettime is not supported

What it means

Stub in Windmill's R parser WASM crate (wasm_libc.rs:281). clock_gettime is not implemented in the WASM libc shim, so any call from the compiled parser panics with 'clock_gettime is not supported'. The shim only exists to satisfy the linker; time functions have no meaning in the sandboxed WASM runtime and were deliberately omitted.

Source

Thrown at backend/parsers/windmill-parser-r/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. Upgrade the windmill-parser-r crate/shim so clock_gettime is implemented (e.g. return a fixed value) instead of panicking
  2. Patch wasm_libc.rs to provide a trivial clock_gettime implementation (write zeroed timespec) and rebuild the WASM module
  3. Check which R input triggers the timing path and avoid that construct if the parser version cannot be changed
  4. Report the panic with the WASM backtrace so the shim can gain the missing symbol

Example fix

// before
pub extern "C" fn clock_gettime(ptr: usize, new_size: usize) {
    panic!("clock_gettime is not supported");
}
// after
pub unsafe extern "C" fn clock_gettime(clk_id: c_int, tp: *mut timespec) {
    if !tp.is_null() { (*tp).tv_sec = 0; (*tp).tv_nsec = 0; }
}
Defensive patterns

Strategy: try-catch

Validate before calling

// Pre-check the runtime can parse without time syscalls:
try { rParser.parse('x <- 1'); } catch (e) { throw new Error('R parser runtime unusable: ' + e.message); }

Type guard

function isClockPanic(e) {
  return e instanceof Error && e.message.includes('clock_gettime is not supported');
}

Try / catch

try {
  const ast = rParser.parse(rSource);
} catch (e) {
  if (isClockPanic(e)) return null; // treat as parse-unavailable, do not retry
  throw e;
}

Prevention

When it happens

Trigger: The R parser WASM executes code that queries the monotonic/realtime clock via C's clock_gettime (CLOCK_MONOTONIC/CLOCK_REALTIME), typically from a benchmarking, timing, or RNG-seeding path in the embedded runtime.

Common situations: Parsing R scripts whose runtime initializes something time-based; running an older/newer parser build that newly pulls in time-dependent C code; WASM/browser environments without host time syscalls wired up.

Related errors


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