From 3e0ca555b5eb7b08c80c19a6feebc5fd0143a669 Mon Sep 17 00:00:00 2001 From: "russell@unturf.com" Date: Fri, 5 Jun 2026 18:58:45 -0400 Subject: [PATCH] examples/cuda-fanout: guard delete-file in 3 binary handlers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit handle-binary-shake, handle-binary-cgbn, handle-binary-secp each called (delete-file in-path) (delete-file out-path) unconditionally in both the daemon-ok and daemon-error branches — 6 sites total. When the daemon failed without producing out-path (e.g. crash, OOM, bad payload), delete-file raised file-not-found and the entire listener exited. Crashed 3090-ai once during ai.foxhop.net deployment smoke. Wrap every delete-file with (if (file-exists? PATH) (delete-file PATH)) so a missing portal cannot kill the worker. (ok pong) sanity check passes on Python tier. Sites (12 guards = 6 path pairs × 2 paths): handle-binary-shake : ok branch + error branch handle-binary-cgbn : ok branch + error branch handle-binary-secp : ok branch + error branch --- examples/cuda-fanout/gpu-worker.lsp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/examples/cuda-fanout/gpu-worker.lsp b/examples/cuda-fanout/gpu-worker.lsp index 432ad58..a81e7a6 100644 --- a/examples/cuda-fanout/gpu-worker.lsp +++ b/examples/cuda-fanout/gpu-worker.lsp @@ -273,10 +273,12 @@ (cond ((eq? status 'ok) (let ((result-blob (read-binary-file out-path))) - (delete-file in-path) (delete-file out-path) + (if (file-exists? in-path) (delete-file in-path)) + (if (file-exists? out-path) (delete-file out-path)) (wire-send-raw client (string-append "BSHR" result-blob)))) (else - (delete-file in-path) (delete-file out-path) + (if (file-exists? in-path) (delete-file in-path)) + (if (file-exists? out-path) (delete-file out-path)) (wire-send-raw client (string-append "BERR" (cdr status)))))))) ;; Binary wire for bend form B (cuda-bignum-cgbn). @@ -296,7 +298,8 @@ (cond ((eq? status 'ok) (let ((result-blob (read-binary-file out-path))) - (delete-file in-path) (delete-file out-path) + (if (file-exists? in-path) (delete-file in-path)) + (if (file-exists? out-path) (delete-file out-path)) (display ";;; bend DONE cuda-bignum-cgbn") (display " wall-ms=") (display wall-ms) (display " out-bytes=") (display (string-length result-blob)) @@ -305,7 +308,8 @@ (else (display ";;; bend FAIL cuda-bignum-cgbn wall-ms=") (display wall-ms) (newline) - (delete-file in-path) (delete-file out-path) + (if (file-exists? in-path) (delete-file in-path)) + (if (file-exists? out-path) (delete-file out-path)) (wire-send-raw client (string-append "BERR" (cdr status))))))))) ;; Binary wire for bend form A (cuda-secp256k1-batched-mul). @@ -326,7 +330,8 @@ (cond ((eq? status 'ok) (let ((result-blob (read-binary-file out-path))) - (delete-file in-path) (delete-file out-path) + (if (file-exists? in-path) (delete-file in-path)) + (if (file-exists? out-path) (delete-file out-path)) (display ";;; bend DONE cuda-secp256k1-batched-mul") (display " wall-ms=") (display wall-ms) (display " out-bytes=") (display (string-length result-blob)) @@ -335,7 +340,8 @@ (else (display ";;; bend FAIL cuda-secp256k1-batched-mul wall-ms=") (display wall-ms) (newline) - (delete-file in-path) (delete-file out-path) + (if (file-exists? in-path) (delete-file in-path)) + (if (file-exists? out-path) (delete-file out-path)) (wire-send-raw client (string-append "BERR" (cdr status))))))))) ;; Accept one client, handle one request, close. Returns #t to keep