aboutsummaryrefslogtreecommitdiff
path: root/guix-build-coordinator/agent-messaging
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2023-06-04 18:34:20 +0100
committerChristopher Baines <mail@cbaines.net>2023-06-04 18:34:20 +0100
commite235947d848a92067ec86cf13f7990a4559c58d1 (patch)
tree39268b2d7598b47233245640115f768f5c6dd43b /guix-build-coordinator/agent-messaging
parentc44d485bba42034804beb47afc23005c4e73ea96 (diff)
downloadbuild-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.
Diffstat (limited to 'guix-build-coordinator/agent-messaging')
-rw-r--r--guix-build-coordinator/agent-messaging/http/server.scm15
1 files changed, 13 insertions, 2 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))