diff options
author | Christopher Baines <mail@cbaines.net> | 2023-12-09 09:48:04 +0000 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2023-12-09 09:48:04 +0000 |
commit | 7df64ca45a06f7e4ca3e43419635ef8ad0d305a5 (patch) | |
tree | 1dcaa6dcff253bef1a1a1a6fab866cc2f2df642c | |
parent | e5d6c72717de93b7b6d64c7febabf1dfc547d480 (diff) | |
download | build-coordinator-7df64ca45a06f7e4ca3e43419635ef8ad0d305a5.tar build-coordinator-7df64ca45a06f7e4ca3e43419635ef8ad0d305a5.tar.gz |
Improve thread pool and work queue backtraces
To try and get more information about "conversion to port encoding failed".
-rw-r--r-- | guix-build-coordinator/utils.scm | 28 |
1 files changed, 26 insertions, 2 deletions
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) |