{"record":{"id":"680d480af1846c00","repo":"windmill-labs/windmill","slug":"clock-gettime-is-not-supported-680d48","errorCode":null,"errorMessage":"clock_gettime is not supported","messagePattern":"clock_gettime is not supported","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"backend/parsers/windmill-parser-ruby/src/wasm_libc.rs","lineNumber":281,"sourceCode":"    _nmemb: usize,\n    _stream: *mut c_void,\n) -> usize {\n    panic!(\"fwrite is not supported\");\n}\n\n#[no_mangle]\npub unsafe extern \"C\" fn vsnprintf(\n    _buf: *mut c_char,\n    _size: usize,\n    _format: *const c_char,\n    _args: ...\n) -> c_int {\n    panic!(\"vsnprintf is not supported\");\n}\n\n#[no_mangle]\npub extern \"C\" fn clock_gettime(ptr: usize, new_size: usize) {\n    panic!(\"clock_gettime is not supported\");\n}\n\n// int snprintf( char* restrict buffer, size_t bufsz, const char* restrict format, ... );\n#[no_mangle]\npub extern \"C\" fn snprintf() {\n    panic!(\"snprintf is not supported\");\n}\n\n#[no_mangle]\npub extern \"C\" fn __assert_fail(_: *const i32, _: *const i32, _: *const i32, _: *const i32) {\n    panic!(\"oh no\");\n}\n","sourceCodeStart":263,"sourceCodeEnd":294,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/backend/parsers/windmill-parser-ruby/src/wasm_libc.rs#L263-L294","documentation":"`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.","triggerScenarios":"Calling the exported `clock_gettime` symbol, or Ruby code / VM internals measuring elapsed time via C `clock_gettime` during parse.","commonSituations":"Gems using timers, benchmarking, or timeout logic with C-level time calls executed inside the wasm parser.","solutions":["Remove time-measurement code from the Ruby code being parsed","Obtain time from the host application and pass it in as data","Wire the shim to WASI `clock_time_get` if timing inside the sandbox is required"],"exampleFix":"// before\nelapsed = Time.now - start\n// after\n# compute timing on the host side; keep the parsed code time-free","handlingStrategy":"validation","validationCode":"fn uses_time_calls(ruby_src: &str) -> bool {\n    [\"Time.now\", \"Process.clock_gettime\", \"Benchmark\"].iter().any(|p| ruby_src.contains(p))\n}","typeGuard":null,"tryCatchPattern":"let result = std::panic::catch_unwind(|| parse_ruby(source));\nif result.is_err() { return Err(\"parser sandbox does not support clock_gettime; pass time in as data\".into()); }","preventionTips":["Inject timestamps from the host instead of calling Time.now inside the sandbox","Avoid benchmarking/timeout gems in parsed code","Review scripts for clock APIs before parsing"],"tags":["wasm","ruby","libc","time","unsupported-operation"],"backgroundTag":"wasm-unsupported-libc-call","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"}