summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Vatamaniuc <vatamane@gmail.com>2022-05-25 23:23:49 -0400
committerNick Vatamaniuc <nickva@users.noreply.github.com>2022-05-26 01:14:27 -0400
commit3898165727aada699d59a1f885d9175696da9093 (patch)
treeff6302a27e6ba8c9ad9eab44cc64a5939967ab62
parent7ca7fd94a47355c4042fc0ae6c51e181ba5fadf8 (diff)
downloadcouchdb-3898165727aada699d59a1f885d9175696da9093.tar.gz
Handle exit(shutdown) error in chttpd
We handle mochiweb's `{shutdown, Error}` exit. However, chttpd itself exits with a plain `exit(shutdown)`, and in that case, our nested catch statements [1] will emit an "unknown_error" log line. So, make sure to handle that as well in order to keep the log noise down. [1] `handle_req_after_auth/2` is nested inside `process_request/1` https://github.com/apache/couchdb/blob/3.x/src/chttpd/src/chttpd.erl#L386 and both call `catch_error/4`
-rw-r--r--src/chttpd/src/chttpd.erl2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/chttpd/src/chttpd.erl b/src/chttpd/src/chttpd.erl
index 4f6ec06c7..48280e80c 100644
--- a/src/chttpd/src/chttpd.erl
+++ b/src/chttpd/src/chttpd.erl
@@ -1140,6 +1140,8 @@ maybe_handle_error(Error) ->
{500, couch_util:to_binary(Err), couch_util:to_binary(Reason)};
normal ->
exit(normal);
+ shutdown ->
+ exit(shutdown);
Err ->
{500, <<"unknown_error">>, couch_util:to_binary(Err)}
end.