{"record":{"id":"c19e8b3e2630b1a2","repo":"windmill-labs/windmill","slug":"aborted-from-c-c19e8b","errorCode":null,"errorMessage":"Aborted from C","messagePattern":"Aborted from C","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"backend/parsers/windmill-parser-ruby/src/wasm_libc.rs","lineNumber":15,"sourceCode":"use std::collections::BTreeMap;\nuse std::sync::{Mutex, OnceLock};\nuse std::{\n    alloc::{self, Layout},\n    ffi::{c_char, c_int, c_void},\n    mem::align_of,\n    ptr,\n};\nuse wasm_bindgen::prelude::*;\n\n/* -------------------------------- stdlib.h -------------------------------- */\n\n#[no_mangle]\npub unsafe extern \"C\" fn abort() {\n    panic!(\"Aborted from C\");\n}\n\nmacro_rules! console_log {\n    ($($t:tt)*) => (unsafe { log(&format_args!($($t)*).to_string()) })\n}\n\n#[wasm_bindgen]\nextern \"C\" {\n    #[wasm_bindgen(js_namespace = console)]\n    fn log(a: &str);\n}\n\n#[no_mangle]\npub unsafe extern \"C\" fn malloc(size: usize) -> *mut c_void {\n    if size == 0 {\n        return ptr::null_mut();\n    }\n","sourceCodeStart":1,"sourceCodeEnd":33,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/backend/parsers/windmill-parser-ruby/src/wasm_libc.rs#L1-L33","documentation":"abort() in the Ruby parser WASM libc shim (backend/parsers/windmill-parser-ruby/src/wasm_libc.rs:15) is re-exported so the compiled Ruby parser links; when the embedded C/Ruby runtime calls C abort(), the shim panics with 'Aborted from C'. This means the WASM guest deliberately aborted execution — usually after detecting an unrecoverable internal error (failed assert, out-of-memory in the guest heap, or an explicit C abort call).","triggerScenarios":"The compiled Ruby parser WASM calls C abort(): a guest-side assertion failure, guest heap allocation failure caught by the runtime, or an explicit abort() in the embedded interpreter's C code.","commonSituations":"Parsing pathological Ruby input that drives the interpreter into a fatal path; guest memory exhaustion inside the WASM sandbox; parser runtime bugs under specific Ruby syntax.","solutions":["Reduce/simplify the Ruby input to find the construct that aborts the parser and remove or rework it","Increase the WASM memory limit / parser resources if the abort is guest OOM (check the runtime configuration hosting the parser)","Upgrade windmill-parser-ruby or the bundled Ruby parser build to a version fixing the aborting path","Capture the WASM backtrace and report the triggering input upstream"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Guard the Ruby parser entry point:\nif (typeof rubySource !== 'string') throw new TypeError('rubySource must be a string');\nif (rubySource.length > MAX_PARSE_SIZE) throw new Error('Input too large for WASM parser');","typeGuard":"function isAbortFromC(e) {\n  return e instanceof Error && e.message === 'Aborted from C';\n}","tryCatchPattern":"try {\n  const ast = rubyParser.parse(rubySource);\n} catch (e) {\n  if (isAbortFromC(e)) {\n    return null; // guest aborted; surface a clean 'unparseable' result\n  }\n  throw e;\n}","preventionTips":["Bisect large Ruby inputs to find the construct that aborts the guest","Watch guest memory limits — abort() often follows WASM OOM in the sandbox","Re-run parsing after every parser upgrade; abort paths change between builds","Always wrap parse calls; a guest abort cannot be recovered in place"],"tags":["wasm","rust","abort","ruby","parser"],"backgroundTag":"wasm-abort-from-c","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"}