From 7df64ca45a06f7e4ca3e43419635ef8ad0d305a5 Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Sat, 9 Dec 2023 09:48:04 +0000 Subject: Improve thread pool and work queue backtraces To try and get more information about "conversion to port encoding failed". --- guix-build-coordinator/utils.scm | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) (limited to 'guix-build-coordinator') diff --git a/guix-build-coordinator/utils.scm b/guix-build-coordinator/utils.scm index e07ed9b..81d0899 100644 --- a/guix-build-coordinator/utils.scm +++ b/guix-build-coordinator/utils.scm @@ -925,7 +925,15 @@ References: ~a~%" (current-error-port) "~A work queue, exception when handling job: ~A ~A\n" name key args) - (backtrace)))) + (let* ((stack (make-stack #t 3)) + (backtrace + (call-with-output-string + (lambda (port) + (display-backtrace stack port) + (newline port))))) + (display + backtrace + (current-error-port)))))) #:unwind? #t)) (define (start-thread thread-index) @@ -1108,7 +1116,23 @@ References: ~a~%" (current-error-port))) #:unwind? #t)) (lambda () - (apply proc job-args)) + (with-throw-handler #t + (lambda () + (apply proc job-args)) + (lambda (key . args) + (simple-format + (current-error-port) + "~A thread pool, exception when handling job: ~A ~A\n" + name key args) + (let* ((stack (make-stack #t 3)) + (backtrace + (call-with-output-string + (lambda (port) + (display-backtrace stack port) + (newline port))))) + (display + backtrace + (current-error-port)))))) #:unwind? #t)) (define (start-thread thread-index) -- cgit v1.2.3