{"record":{"id":"3cd2f1fc8be42959","repo":"windmill-labs/windmill","slug":"clock-is-not-supported-3cd2f1","errorCode":null,"errorMessage":"clock is not supported","messagePattern":"clock is not supported","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"backend/parsers/windmill-parser-ruby/src/wasm_libc.rs","lineNumber":222,"sourceCode":"    }\n    0 // Return false (0)\n}\n\n#[no_mangle]\npub extern \"C\" fn iswlower(wc: wint_t) -> c_int {\n    // Check if the character is a lowercase letter ('a' to 'z')\n    if wc >= 'a' as wint_t && wc <= 'z' as wint_t {\n        return 1; // Return true (1)\n    }\n    0 // Return false (0)\n}\n// End of AI implemetation\n\n/* --------------------------------- time.h --------------------------------- */\n\n#[no_mangle]\npub unsafe extern \"C\" fn clock() -> u64 {\n    panic!(\"clock is not supported\");\n}\n\n/* --------------------------------- ctype.h -------------------------------- */\n\n#[no_mangle]\npub unsafe extern \"C\" fn isprint(c: c_int) -> bool {\n    c >= 32 && c <= 126\n}\n\n/* --------------------------------- stdio.h -------------------------------- */\n\n#[no_mangle]\npub unsafe extern \"C\" fn fprintf(_file: *mut c_void, _format: *const c_void, _args: ...) -> c_int {\n    panic!(\"fprintf is not supported\");\n}\n\n#[no_mangle]\npub unsafe extern \"C\" fn fputs(_s: *const c_void, _file: *mut c_void) -> c_int {","sourceCodeStart":204,"sourceCodeEnd":240,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/backend/parsers/windmill-parser-ruby/src/wasm_libc.rs#L204-L240","documentation":"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.","triggerScenarios":"The embedded Ruby parser's C code calls clock() (CPU-time measurement), typically from benchmarking/profiling hooks or timeouts inside the interpreter.","commonSituations":"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().","solutions":["Patch wasm_libc.rs to return a dummy value (e.g. 0 as u64) from clock() instead of panicking, and rebuild the parser WASM","Upgrade windmill-parser-ruby to a build that stubs clock() benignly","Avoid inputs/code paths that activate the interpreter's timing hooks","Report the panic with backtrace so the shim gains the symbol"],"exampleFix":"// before\npub unsafe extern \"C\" fn clock() -> u64 {\n    panic!(\"clock is not supported\");\n}\n// after\npub unsafe extern \"C\" fn clock() -> u64 {\n    0 // CPU time is meaningless in the WASM sandbox; report a constant\n}","handlingStrategy":"try-catch","validationCode":"// Detect parser builds that link timing code before using them in production:\ntry { rubyParser.parse('1'); } catch (e) {\n  if (e.message.includes('clock is not supported')) console.warn('timing-linked parser build');\n}","typeGuard":"function isClockPanic(e) {\n  return e instanceof Error && e.message.includes('clock is not supported');\n}","tryCatchPattern":"try {\n  const ast = rubyParser.parse(rubySource);\n} catch (e) {\n  if (isClockPanic(e)) return null; // deterministic; no retry\n  throw e;\n}","preventionTips":["Stub clock() to return 0 when rebuilding the parser WASM","Avoid parser configurations that enable profiling/timing hooks in the guest","Test representative inputs after parser upgrades to catch newly linked symbols","Do not retry: the panic is deterministic per build/input pair"],"tags":["wasm","rust","libc","time","ruby"],"backgroundTag":"wasm-libc-function-not-supported","analyzedSha":"e474e8803ce2ff5c2df09a58dab51d45f5c922ca","analyzedAt":"2026-09-03T12:38:19.024Z","contentChangedAt":"2026-09-03T12:38:19.024Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}