Catch errors while processing a request #164
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
If clack with hunchentoot is launched and errors while processing requests occur many times, the server always returns a 503 response only, which does'nt seems to be an expected behaviour. This PR fixes this issue.
The following is an example for reproducing the issue:
Server:
Client:
The issue is because the current hunchentoot handler doesn't catch errors while processing a request, but invoke the debugger, which makes the thread stop. The thread is alive with the debugger being invoked. Many errors cause many threads and the server can't create anther thread for a new request.
hunchentoot:*catch-errors-p*
is the variable whose value decides whether the debugger is invoked or not. The nil value invokes the debugger. While theclack.handler.hunchentoot::initialize
method sets the variable to T,clack.handler.hunchentoot::acceptor-dispatch-request
rebinds the variable to nil, which seems to be the root cause.