diff options
author | Christopher Baines <mail@cbaines.net> | 2023-06-04 18:34:20 +0100 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2023-06-04 18:34:20 +0100 |
commit | e235947d848a92067ec86cf13f7990a4559c58d1 (patch) | |
tree | 39268b2d7598b47233245640115f768f5c6dd43b | |
parent | c44d485bba42034804beb47afc23005c4e73ea96 (diff) | |
download | build-coordinator-e235947d848a92067ec86cf13f7990a4559c58d1.tar build-coordinator-e235947d848a92067ec86cf13f7990a4559c58d1.tar.gz |
Try and get backtraces when current output port seems broken
With the "conversion to port encoding failed" (#62590) error, I'm seeing the
"error: when processing" logs, but the backtrace doesn't get logged, maybe
because it's going to the current output port, which might be broken?
Anyway, try sending the backtrace to the current error port, in the hope that
this port is still working.
-rw-r--r-- | guix-build-coordinator/agent-messaging/http/server.scm | 15 | ||||
-rw-r--r-- | guix-build-coordinator/client-communication.scm | 13 |
2 files changed, 25 insertions, 3 deletions
diff --git a/guix-build-coordinator/agent-messaging/http/server.scm b/guix-build-coordinator/agent-messaging/http/server.scm index c001546..e3ced38 100644 --- a/guix-build-coordinator/agent-messaging/http/server.scm +++ b/guix-build-coordinator/agent-messaging/http/server.scm @@ -1040,8 +1040,19 @@ port. Also, the port used can be changed by passing the --port option.\n" ((method path-components ...) (simple-format (current-error-port) - "error: when processing: /~A ~A\n ~A ~A" + "error: when processing: /~A ~A\n ~A ~A\n" method (string-join path-components "/") key args))) - (backtrace))))) + + (let* ((stack (make-stack #t 4)) + (backtrace + (call-with-output-string + (lambda (port) + (display "\nBacktrace:\n" port) + (display-backtrace stack port) + (newline port) + (newline port))))) + (display + backtrace + (current-error-port))))))) #:unwind? #t)) diff --git a/guix-build-coordinator/client-communication.scm b/guix-build-coordinator/client-communication.scm index 2df9b32..d7877b3 100644 --- a/guix-build-coordinator/client-communication.scm +++ b/guix-build-coordinator/client-communication.scm @@ -636,7 +636,18 @@ "error: when processing client request: /~A ~A\n ~A ~A\n" method (string-join path-components "/") key args))) - (backtrace))))) + + (let* ((stack (make-stack #t 4)) + (backtrace + (call-with-output-string + (lambda (port) + (display "\nBacktrace:\n" port) + (display-backtrace stack port) + (newline port) + (newline port))))) + (display + backtrace + (current-error-port))))))) #:unwind? #t)) (define* (render-json json #:key (extra-headers '()) |