couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rnew...@apache.org
Subject git commit: Terminate process that exceeds rewrite limit
Date Fri, 15 Feb 2013 21:32:33 GMT
Updated Branches:
  refs/heads/1651-recursive-rewrite-leak [created] 8199c5d86


Terminate process that exceeds rewrite limit

A process that exceeds rewrite limit returns a 400 error to the client
but can then be used for further requests, which also return 400
incorrectly.

This patch ensures the request process dies, taking its process
dictionary with it.

COUCHDB-1651


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/8199c5d8
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/8199c5d8
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/8199c5d8

Branch: refs/heads/1651-recursive-rewrite-leak
Commit: 8199c5d86c5548659e14e342b659dd233ad65096
Parents: 6beb66c
Author: Robert Newson <rnewson@apache.org>
Authored: Fri Feb 15 21:30:28 2013 +0000
Committer: Robert Newson <rnewson@apache.org>
Committed: Fri Feb 15 21:30:28 2013 +0000

----------------------------------------------------------------------
 src/couchdb/couch_httpd.erl         |    3 +++
 src/couchdb/couch_httpd_rewrite.erl |    2 +-
 2 files changed, 4 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/8199c5d8/src/couchdb/couch_httpd.erl
----------------------------------------------------------------------
diff --git a/src/couchdb/couch_httpd.erl b/src/couchdb/couch_httpd.erl
index 3e3415b..6e03996 100644
--- a/src/couchdb/couch_httpd.erl
+++ b/src/couchdb/couch_httpd.erl
@@ -348,6 +348,9 @@ handle_request_int(MochiReq, DefaultFun,
             send_error(HttpReq, bad_request);
         exit:normal ->
             exit(normal);
+        exit:{bad_request, Reason} ->
+            send_error(HttpReq, {bad_request, Reason}),
+            exit(normal);
         exit:snappy_nif_not_loaded ->
             ErrorReason = "To access the database or view index, Apache CouchDB"
                 " must be built with Erlang OTP R13B04 or higher.",

http://git-wip-us.apache.org/repos/asf/couchdb/blob/8199c5d8/src/couchdb/couch_httpd_rewrite.erl
----------------------------------------------------------------------
diff --git a/src/couchdb/couch_httpd_rewrite.erl b/src/couchdb/couch_httpd_rewrite.erl
index 756cdef..903b394 100644
--- a/src/couchdb/couch_httpd_rewrite.erl
+++ b/src/couchdb/couch_httpd_rewrite.erl
@@ -127,7 +127,7 @@ handle_rewrite_req(#httpd{
         NumRewrites when NumRewrites < MaxRewrites ->
             put(couch_rewrite_count, NumRewrites + 1);
         _ ->
-            throw({bad_request, <<"Exceeded rewrite recursion limit">>})
+            exit({bad_request, <<"Exceeded rewrite recursion limit">>})
     end,
 
     #doc{body={Props}} = DDoc,


Mime
View raw message