{"record":{"id":"ac18873515627952","repo":"windmill-labs/windmill","slug":"aborted-from-c","errorCode":null,"errorMessage":"Aborted from C","messagePattern":"Aborted from C","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"backend/parsers/windmill-parser-csharp/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-csharp/src/wasm_libc.rs#L1-L33","documentation":"The C# parser compiles C# to WASM using a minimal libc shim. This export implements abort() from stdlib.h: when compiled C# code (or its runtime/libc) calls abort(), the shim panics with 'Aborted from C' to unwind and surface the abort inside the WASM host. The message means the parsed/compiled program executed an abort path rather than a normal return.","triggerScenarios":"C# code under windmill-parser-csharp invoking abort() — e.g. assert failures, unhandled fatal conditions in the Mono/runtime WASM runtime, or stdlib abort calls triggered during script parsing/compilation.","commonSituations":"Runtime assertions firing in WASM-compiled C# workers; memory/allocation failures inside the embedded runtime; malformed C# that drives a library into an abort path during preprocessing.","solutions":["Inspect the C# code/log immediately before the abort to find the failing assertion or runtime condition","Update the parser's WASM runtime dependencies if the abort comes from a known upstream runtime bug","Reproduce with a minimal C# script to isolate the code path that triggers abort()","Report/upgrade via windmill-parser-csharp if the abort originates in the vendored libc/runtime shim"],"exampleFix":"null","handlingStrategy":"try-catch","validationCode":"// sanity-check C# input before handing it to the parser\nif strings.TrimSpace(csSource) == \"\" {\n    return errors.New(\"empty C# source will not compile\")\n}","typeGuard":null,"tryCatchPattern":"// catch panics from the WASM parser boundary\nfunc safeParse(src []byte) (out []byte, err error) {\n    defer func() {\n        if r := recover(); r != nil {\n            err = fmt.Errorf(\"csharp parser aborted: %v\", r)\n        }\n    }()\n    return parseCSharp(src), nil\n}","preventionTips":["Keep the vendored WASM runtime/libc shim up to date","Isolate failing C# snippets to find what triggers abort()","Catch panics at the WASM boundary in the host so aborts become errors, not crashes","Check parser logs immediately preceding the abort for assertion messages"],"tags":["rust","csharp","wasm","parser","abort"],"backgroundTag":"wasm-runtime-abort","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"}