windmill-labs/windmill · critical

Aborted from C

Error message

Aborted from C

What it means

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.

Source

Thrown at backend/parsers/windmill-parser-csharp/src/wasm_libc.rs:15

use std::collections::BTreeMap;
use std::sync::{Mutex, OnceLock};
use std::{
    alloc::{self, Layout},
    ffi::{c_char, c_int, c_void},
    mem::align_of,
    ptr,
};
use wasm_bindgen::prelude::*;

/* -------------------------------- stdlib.h -------------------------------- */

#[no_mangle]
pub unsafe extern "C" fn abort() {
    panic!("Aborted from C");
}

macro_rules! console_log {
    ($($t:tt)*) => (unsafe { log(&format_args!($($t)*).to_string()) })
}

#[wasm_bindgen]
extern "C" {
    #[wasm_bindgen(js_namespace = console)]
    fn log(a: &str);
}

#[no_mangle]
pub unsafe extern "C" fn malloc(size: usize) -> *mut c_void {
    if size == 0 {
        return ptr::null_mut();
    }

View on GitHub (pinned to e474e8803c)

Solutions

  1. Inspect the C# code/log immediately before the abort to find the failing assertion or runtime condition
  2. Update the parser's WASM runtime dependencies if the abort comes from a known upstream runtime bug
  3. Reproduce with a minimal C# script to isolate the code path that triggers abort()
  4. Report/upgrade via windmill-parser-csharp if the abort originates in the vendored libc/runtime shim

Example fix

null
Defensive patterns

Strategy: try-catch

Validate before calling

// sanity-check C# input before handing it to the parser
if strings.TrimSpace(csSource) == "" {
    return errors.New("empty C# source will not compile")
}

Try / catch

// catch panics from the WASM parser boundary
func safeParse(src []byte) (out []byte, err error) {
    defer func() {
        if r := recover(); r != nil {
            err = fmt.Errorf("csharp parser aborted: %v", r)
        }
    }()
    return parseCSharp(src), nil
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


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