This is an automated email from the ASF dual-hosted git repository. rnewson pushed a commit to branch changes-count in repository https://gitbox.apache.org/repos/asf/couchdb.git
commit 2f19cd07dc9efbb836f22d98fb284c927af31ea6 Author: Robert Newson <[email protected]> AuthorDate: Wed Dec 3 12:08:37 2025 +0000 ensure we decrement clients_requesting_changes ensure we decrement clients_requesting_changes even if the mochiweb process mediating the change request is killed by the client disconnect detector. --- src/chttpd/src/chttpd_db.erl | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/chttpd/src/chttpd_db.erl b/src/chttpd/src/chttpd_db.erl index 5ef69f33f..34e389409 100644 --- a/src/chttpd/src/chttpd_db.erl +++ b/src/chttpd/src/chttpd_db.erl @@ -151,11 +151,15 @@ handle_changes_req1(#httpd{} = Req, Db) -> mochi = Req, threshold = Max }, - try - fabric:changes(Db, fun changes_callback/2, Acc0, ChangesArgs) - after - couch_stats:decrement_counter([couchdb, httpd, clients_requesting_changes]) - end; + Self = self(), + spawn(fun() -> + MonitorRef = monitor(process, Self), + receive + {'DOWN', MonitorRef, process, Self, _Info} -> + couch_stats:decrement_counter([couchdb, httpd, clients_requesting_changes]) + end + end), + fabric:changes(Db, fun changes_callback/2, Acc0, ChangesArgs); _ -> Msg = <<"Supported `feed` types: normal, continuous, live, longpoll, eventsource">>, throw({bad_request, Msg})
