diff options
author | Robert Newson <rnewson@apache.org> | 2011-05-28 16:50:10 +0000 |
---|---|---|
committer | Robert Newson <rnewson@apache.org> | 2011-05-28 16:50:10 +0000 |
commit | 31e900ee642e672cec0b7b561c4bb596e1acf9a5 (patch) | |
tree | 2bc170c12a0575fe9ca0f2da1d418e2e72e0f1bb | |
parent | 57bb30a736a7e0635c3cab394b946b1acbbed266 (diff) |
COUCHDB-1171 Multiple requests to _changes feed causes {error, system_limit} "Too many processes"
git-svn-id: https://svn.apache.org/repos/asf/couchdb/branches/1.1.x@1128704 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | share/www/script/test/changes.js | 4 | ||||
-rw-r--r-- | src/couchdb/couch_httpd_db.erl | 11 |
2 files changed, 12 insertions, 3 deletions
diff --git a/share/www/script/test/changes.js b/share/www/script/test/changes.js index 5998f48c..ea22bfb3 100644 --- a/share/www/script/test/changes.js +++ b/share/www/script/test/changes.js @@ -503,6 +503,10 @@ couchTests.changes = function(debug) { TEquals("0", resp.results[0].id); TEquals("1", resp.results[1].id); + TEquals(0, CouchDB.requestStats('httpd', 'clients_requesting_changes').current); + CouchDB.request("GET", "/" + db.name + "/_changes"); + TEquals(0, CouchDB.requestStats('httpd', 'clients_requesting_changes').current); + // cleanup db.deleteDb(); }; diff --git a/src/couchdb/couch_httpd_db.erl b/src/couchdb/couch_httpd_db.erl index f51fde09..e3638b25 100644 --- a/src/couchdb/couch_httpd_db.erl +++ b/src/couchdb/couch_httpd_db.erl @@ -114,11 +114,16 @@ handle_changes_req1(Req, Db) -> FeedChangesFun(MakeCallback(Resp)) end end, - couch_stats_collector:track_process_count( + couch_stats_collector:increment( {httpd, clients_requesting_changes} ), - WrapperFun(ChangesFun). - + try + WrapperFun(ChangesFun) + after + couch_stats_collector:decrement( + {httpd, clients_requesting_changes} + ) + end. handle_compact_req(#httpd{method='POST',path_parts=[DbName,_,Id|_]}=Req, Db) -> ok = couch_db:check_is_admin(Db), |