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:
parent
768c2b6a5b
commit
bb6d9fd89d
1 changed files with 22 additions and 13 deletions
|
|
@ -575,6 +575,14 @@ before sending back to the client."
|
||||||
(sigaction SIGPIPE SIG_IGN)
|
(sigaction SIGPIPE SIG_IGN)
|
||||||
|
|
||||||
(spawn-fiber
|
(spawn-fiber
|
||||||
|
(lambda ()
|
||||||
|
(while #t
|
||||||
|
(with-exception-handler
|
||||||
|
(const #t)
|
||||||
|
(lambda ()
|
||||||
|
(with-exception-handler
|
||||||
|
(lambda (exn)
|
||||||
|
(print-backtrace-and-exception/knots exn))
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(let loop ()
|
(let loop ()
|
||||||
(match (accept socket (logior SOCK_NONBLOCK SOCK_CLOEXEC))
|
(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/safe
|
||||||
post-request-hook)))
|
post-request-hook)))
|
||||||
#:parallel? #t)
|
#:parallel? #t)
|
||||||
(loop))))))
|
(loop)))))))
|
||||||
|
#:unwind? #t))))
|
||||||
|
|
||||||
(make-web-server socket
|
(make-web-server socket
|
||||||
(vector-ref (getsockname socket)
|
(vector-ref (getsockname socket)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue