You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by va...@apache.org on 2022/05/26 05:14:33 UTC

[couchdb] branch 3.x updated: Handle exit(shutdown) error in chttpd

This is an automated email from the ASF dual-hosted git repository.

vatamane pushed a commit to branch 3.x
in repository https://gitbox.apache.org/repos/asf/couchdb.git


The following commit(s) were added to refs/heads/3.x by this push:
     new 389816572 Handle exit(shutdown) error in chttpd
389816572 is described below

commit 3898165727aada699d59a1f885d9175696da9093
Author: Nick Vatamaniuc <va...@gmail.com>
AuthorDate: Wed May 25 23:23:49 2022 -0400

    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`
---
 src/chttpd/src/chttpd.erl | 2 ++
 1 file changed, 2 insertions(+)

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.