Add exception handling to the server loop

This should start to deal with accept failing if there are too many
open files.
This commit is contained in:
Christopher Baines 2026-03-22 15:04:51 +00:00
parent 768c2b6a5b
commit bb6d9fd89d

View file

@ -575,6 +575,14 @@ before sending back to the client."
(sigaction SIGPIPE SIG_IGN)
(spawn-fiber
(lambda ()
(while #t
(with-exception-handler
(const #t)
(lambda ()
(with-exception-handler
(lambda (exn)
(print-backtrace-and-exception/knots exn))
(lambda ()
(let loop ()
(match (accept socket (logior SOCK_NONBLOCK SOCK_CLOEXEC))
@ -588,7 +596,8 @@ before sending back to the client."
(post-request-hook/safe
post-request-hook)))
#:parallel? #t)
(loop))))))
(loop)))))))
#:unwind? #t))))
(make-web-server socket
(vector-ref (getsockname socket)