examples/cuda-fanout: guard delete-file in 3 binary handlers
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
This commit is contained in:
parent
718a93ff2d
commit
3e0ca555b5
1 changed files with 12 additions and 6 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue