couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rnew...@apache.org
Subject svn commit: r1128703 - in /couchdb/trunk: share/www/script/test/changes.js src/couchdb/couch_httpd_db.erl
Date Sat, 28 May 2011 16:41:07 GMT
Author: rnewson
Date: Sat May 28 16:41:07 2011
New Revision: 1128703

URL: http://svn.apache.org/viewvc?rev=1128703&view=rev
Log:
COUCHDB-1171 Multiple requests to _changes feed causes {error, system_limit} "Too many processes"

Modified:
    couchdb/trunk/share/www/script/test/changes.js
    couchdb/trunk/src/couchdb/couch_httpd_db.erl

Modified: couchdb/trunk/share/www/script/test/changes.js
URL: http://svn.apache.org/viewvc/couchdb/trunk/share/www/script/test/changes.js?rev=1128703&r1=1128702&r2=1128703&view=diff
==============================================================================
--- couchdb/trunk/share/www/script/test/changes.js (original)
+++ couchdb/trunk/share/www/script/test/changes.js Sat May 28 16:41:07 2011
@@ -520,6 +520,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();
 };

Modified: couchdb/trunk/src/couchdb/couch_httpd_db.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_httpd_db.erl?rev=1128703&r1=1128702&r2=1128703&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_httpd_db.erl (original)
+++ couchdb/trunk/src/couchdb/couch_httpd_db.erl Sat May 28 16:41:07 2011
@@ -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),



Mime
View raw message