Catch exn instead of exn:fail in daemon, to prevent accidental daemon exits.
This commit is contained in:
parent
0418e96196
commit
db021c9551
|
@ -8,12 +8,15 @@
|
|||
(define (daemonize-thunk name boot-thunk)
|
||||
(lambda ()
|
||||
(let reboot ()
|
||||
(with-handlers* ((exn:fail? (lambda (e)
|
||||
(log-error "*** DAEMON CRASHED: ~a ***\n~a"
|
||||
name
|
||||
(exn->string e))
|
||||
(sleep 5)
|
||||
(reboot))))
|
||||
;; We would catch exn:fail? here, but exn:pretty in the web
|
||||
;; server is a subtype of exn, not of exn:fail, and that causes
|
||||
;; spurious permanent daemon exits.
|
||||
(with-handlers* ((exn? (lambda (e)
|
||||
(log-error "*** DAEMON CRASHED: ~a ***\n~a"
|
||||
name
|
||||
(exn->string e))
|
||||
(sleep 5)
|
||||
(reboot))))
|
||||
(define result (boot-thunk))
|
||||
(log-warning "Daemon thread ~a exited normally (returning ~v)" name result)))))
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user