Improve thread pool exception logging

This commit is contained in:
Christopher Baines 2025-02-26 10:07:54 +00:00
parent 13f1118576
commit f549bee282

View file

@ -251,7 +251,15 @@ arguments of the thread pool procedure."
(vector-set! thread-proc-vector (vector-set! thread-proc-vector
thread-index thread-index
proc) proc)
(with-throw-handler #t (with-exception-handler
(lambda (exn)
(when (log-exception? exn)
(simple-format
(current-error-port)
"thread-pool: exception running ~A\n" proc)
(print-backtrace-and-exception/knots
exn))
(raise-exception exn))
(lambda () (lambda ()
(call-with-values (call-with-values
(lambda () (lambda ()
@ -262,16 +270,7 @@ arguments of the thread pool procedure."
(cons (/ (- (get-internal-real-time) (cons (/ (- (get-internal-real-time)
start-time) start-time)
internal-time-units-per-second) internal-time-units-per-second)
vals)))) vals))))))
(lambda args
(when (match args
(('%exception exn)
(log-exception? exn))
(_ #t))
(simple-format
(current-error-port)
"thread-pool: exception: ~A\n" args)
(backtrace)))))
#:unwind? #t))) #:unwind? #t)))
(put-message reply (put-message reply
response) response)