Fix handling of client-loop exceptions

Maybe other things can go wrong here, so log so that there's some
information available.
This commit is contained in:
Christopher Baines 2025-02-19 12:44:47 +00:00
parent d597b77fcb
commit ca3d5a1781

View file

@ -338,7 +338,18 @@ on the procedure being called at any particular time."
(let loop () (let loop ()
(cond (cond
((with-exception-handler ((with-exception-handler
(lambda _ #t) (lambda (exn)
(unless (and (exception-with-origin? exn)
(string=? (exception-origin exn)
"fport_write"))
(display "knots web-server, exception in client loop:\n"
(current-error-port))
(print-exception
(current-error-port)
#f
'%exception
(list exn)))
#t)
(lambda () (lambda ()
(or (or
(if (eq? #f connection-idle-timeout) (if (eq? #f connection-idle-timeout)
@ -350,7 +361,8 @@ on the procedure being called at any particular time."
(wrap-operation (wrap-operation
(sleep-operation connection-idle-timeout) (sleep-operation connection-idle-timeout)
(const #t))))) (const #t)))))
(eof-object? (lookahead-u8 client))))) (eof-object? (lookahead-u8 client))))
#:unwind? #t)
(close-port client)) (close-port client))
(else (else
(let ((keep-alive? (handle-request handler client (let ((keep-alive? (handle-request handler client