From 02eb58772c2db5684d1b5bfbcf1144c5950b811f Mon Sep 17 00:00:00 2001 From: John Alanbrook Date: Wed, 18 Feb 2026 19:41:59 -0600 Subject: [PATCH] fix build hangs --- build.cm | 12 ++++++++++++ internal/os.c | 14 +++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/build.cm b/build.cm index ab9fe5fd..529f4def 100644 --- a/build.cm +++ b/build.cm @@ -91,6 +91,7 @@ var SALT_NATIVE = 'native' // native-compiled .cm dylib var SALT_MACH = 'mach' // mach bytecode blob var SALT_MCODE = 'mcode' // mcode IR (JSON) var SALT_DEPS = 'deps' // cached cc -MM dependency list +var SALT_FAIL = 'fail' // cached compilation failure function cache_path(content, salt) { return get_build_dir() + '/' + content_hash(content + '\n' + salt) @@ -246,10 +247,18 @@ Build.compile_file = function(pkg, file, target, opts) { var file_content = fd.slurp(src_path) var quick_content = cmd_str + '\n' + text(file_content) var deps_path = cache_path(quick_content, SALT_DEPS) + var fail_path = cache_path(quick_content, SALT_FAIL) var build_dir = get_build_dir() ensure_dir(build_dir) + // Check for cached failure (skip files that previously failed to compile) + if (fd.is_file(fail_path)) { + if (_opts.verbose) print('[verbose] skipping ' + file + ' (cached failure)') + log.shop('skip ' + file + ' (cached failure)') + return null + } + var deps = null var full_content = null var obj_path = null @@ -310,6 +319,8 @@ Build.compile_file = function(pkg, file, target, opts) { if (err_text) print(err_text) else print('Command: ' + full_cmd) } + // Cache the failure so we don't retry on every build + fd.slurpwrite(fail_path, stone(blob(err_text || 'compilation failed'))) return null } @@ -944,6 +955,7 @@ Build.SALT_NATIVE = SALT_NATIVE Build.SALT_MACH = SALT_MACH Build.SALT_MCODE = SALT_MCODE Build.SALT_DEPS = SALT_DEPS +Build.SALT_FAIL = SALT_FAIL Build.cache_path = cache_path return Build diff --git a/internal/os.c b/internal/os.c index ffe13694..d08083e0 100644 --- a/internal/os.c +++ b/internal/os.c @@ -1,4 +1,5 @@ #include "cell.h" +#include "cell_internal.h" #include #include @@ -306,7 +307,18 @@ static JSValue js_os_rusage(JSContext *js, JSValue self, int argc, JSValue *argv JSC_SCALL(os_system, int err = system(str); - ret = number2js(js,err); + /* Reset actor turn timer after blocking system() call. + The scheduler's kill timer may have fired while system() blocked, + setting pause_flag = 2. Bump turn_gen so stale timer events are + ignored, and clear the pause flag so the VM doesn't raise + "interrupted" on the next backward branch. */ + cell_rt *crt = JS_GetContextOpaque(js); + if (crt) { + atomic_fetch_add_explicit(&crt->turn_gen, 1, memory_order_relaxed); + JS_SetPauseFlag(js, 0); + crt->turn_start_ns = cell_ns(); + } + ret = number2js(js, err); ) JSC_CCALL(os_exit,