windmill-labs/windmill · error

clock is not supported

Error message

clock is not supported

What it means

Stub in the Ruby parser WASM libc shim (wasm_libc.rs:222). The C clock() function is not implemented — the WASM runtime has no CPU-time concept — so any call panics with 'clock is not supported'. The symbol exists purely for link compatibility of the compiled Ruby parser.

Source

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

    }
    0 // Return false (0)
}

#[no_mangle]
pub extern "C" fn iswlower(wc: wint_t) -> c_int {
    // Check if the character is a lowercase letter ('a' to 'z')
    if wc >= 'a' as wint_t && wc <= 'z' as wint_t {
        return 1; // Return true (1)
    }
    0 // Return false (0)
}
// End of AI implemetation

/* --------------------------------- time.h --------------------------------- */

#[no_mangle]
pub unsafe extern "C" fn clock() -> u64 {
    panic!("clock is not supported");
}

/* --------------------------------- ctype.h -------------------------------- */

#[no_mangle]
pub unsafe extern "C" fn isprint(c: c_int) -> bool {
    c >= 32 && c <= 126
}

/* --------------------------------- stdio.h -------------------------------- */

#[no_mangle]
pub unsafe extern "C" fn fprintf(_file: *mut c_void, _format: *const c_void, _args: ...) -> c_int {
    panic!("fprintf is not supported");
}

#[no_mangle]
pub unsafe extern "C" fn fputs(_s: *const c_void, _file: *mut c_void) -> c_int {

View on GitHub (pinned to e474e8803c)

Solutions

  1. Patch wasm_libc.rs to return a dummy value (e.g. 0 as u64) from clock() instead of panicking, and rebuild the parser WASM
  2. Upgrade windmill-parser-ruby to a build that stubs clock() benignly
  3. Avoid inputs/code paths that activate the interpreter's timing hooks
  4. Report the panic with backtrace so the shim gains the symbol

Example fix

// before
pub unsafe extern "C" fn clock() -> u64 {
    panic!("clock is not supported");
}
// after
pub unsafe extern "C" fn clock() -> u64 {
    0 // CPU time is meaningless in the WASM sandbox; report a constant
}
Defensive patterns

Strategy: try-catch

Validate before calling

// Detect parser builds that link timing code before using them in production:
try { rubyParser.parse('1'); } catch (e) {
  if (e.message.includes('clock is not supported')) console.warn('timing-linked parser build');
}

Type guard

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

Try / catch

try {
  const ast = rubyParser.parse(rubySource);
} catch (e) {
  if (isClockPanic(e)) return null; // deterministic; no retry
  throw e;
}

Prevention

When it happens

Trigger: The embedded Ruby parser's C code calls clock() (CPU-time measurement), typically from benchmarking/profiling hooks or timeouts inside the interpreter.

Common situations: Ruby parser builds that include profiling or timing code paths; running in browser/WASM sandboxes without time syscalls; a dependency update that newly links clock().

Related errors


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