CouchDB
  1. CouchDB
  2. COUCHDB-1441

_rewrite handler loops cause cpu load and swap of death

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.2.1, 1.3
    • Component/s: HTTP Interface
    • Labels:
      None
    • Environment:

      debian testing

    • Skill Level:
      Dont Know

      Description

      when creating a simple _rewrite loop, the db will start to eat cpu and take more & more memory

      for testing i created:

      {"_id":"_design/loopa","rewrites":[

      {"from":"","to":"../loopb/_rewrite"}

      ]}
      {"_id":"_design/loopb","rewrites":[

      {"from":"","to":"../loopa/_rewrite"}

      ]}

      accessing $dburi/_design/loopa/_rewrite/ will start the loop

        Activity

        Hide
        ASF GitHub Bot added a comment -

        Github user asfgit closed the pull request at:

        https://github.com/apache/couchdb-chttpd/pull/49

        Show
        ASF GitHub Bot added a comment - Github user asfgit closed the pull request at: https://github.com/apache/couchdb-chttpd/pull/49
        Hide
        ASF subversion and git services added a comment -

        Commit f9cad9dd19fd175d8b26da3d5af10ba70e3513d1 in couchdb-chttpd's branch refs/heads/master from Robert Newson
        [ https://git-wip-us.apache.org/repos/asf?p=couchdb-chttpd.git;h=f9cad9d ]

        Port max_rewrites to chttpd

        This commit incorporates the original work by Ronny Pfannschmidt
        <Ronny.Pfannschmidt@gmx.de> and myself for COUCHDB-1441 and COUCHDB-1651.

        Show
        ASF subversion and git services added a comment - Commit f9cad9dd19fd175d8b26da3d5af10ba70e3513d1 in couchdb-chttpd's branch refs/heads/master from Robert Newson [ https://git-wip-us.apache.org/repos/asf?p=couchdb-chttpd.git;h=f9cad9d ] Port max_rewrites to chttpd This commit incorporates the original work by Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de> and myself for COUCHDB-1441 and COUCHDB-1651 .
        Hide
        ASF GitHub Bot added a comment -

        GitHub user rnewson opened a pull request:

        https://github.com/apache/couchdb-chttpd/pull/49

        Port max_rewrites to chttpd

        This commit incorporates the original work by Ronny Pfannschmidt
        <Ronny.Pfannschmidt@gmx.de> and myself for COUCHDB-1441 and COUCHDB-1651.

        You can merge this pull request into a Git repository by running:

        $ git pull https://github.com/cloudant/couchdb-chttpd max-rewrites

        Alternatively you can review and apply these changes as the patch at:

        https://github.com/apache/couchdb-chttpd/pull/49.patch

        To close this pull request, make a commit to your master/trunk branch
        with (at least) the following in the commit message:

        This closes #49


        commit f9cad9dd19fd175d8b26da3d5af10ba70e3513d1
        Author: Robert Newson <rnewson@apache.org>
        Date: 2015-07-29T17:17:27Z

        Port max_rewrites to chttpd

        This commit incorporates the original work by Ronny Pfannschmidt
        <Ronny.Pfannschmidt@gmx.de> and myself for COUCHDB-1441 and COUCHDB-1651.


        Show
        ASF GitHub Bot added a comment - GitHub user rnewson opened a pull request: https://github.com/apache/couchdb-chttpd/pull/49 Port max_rewrites to chttpd This commit incorporates the original work by Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de> and myself for COUCHDB-1441 and COUCHDB-1651 . You can merge this pull request into a Git repository by running: $ git pull https://github.com/cloudant/couchdb-chttpd max-rewrites Alternatively you can review and apply these changes as the patch at: https://github.com/apache/couchdb-chttpd/pull/49.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #49 commit f9cad9dd19fd175d8b26da3d5af10ba70e3513d1 Author: Robert Newson <rnewson@apache.org> Date: 2015-07-29T17:17:27Z Port max_rewrites to chttpd This commit incorporates the original work by Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de> and myself for COUCHDB-1441 and COUCHDB-1651 .
        Show
        Alexander Shorin added a comment - Already fixed for 1.3: https://git-wip-us.apache.org/repos/asf?p=couchdb.git;a=commit;h=d076976c and for 1.2.1: https://git-wip-us.apache.org/repos/asf?p=couchdb.git;a=commit;h=30334ac8
        Hide
        Ronny Pfannschmidt added a comment -

        a reasonable way to implement this might be to add a counter when rewriting the mochiweb headers in the _rewrite handler

        Show
        Ronny Pfannschmidt added a comment - a reasonable way to implement this might be to add a counter when rewriting the mochiweb headers in the _rewrite handler
        Hide
        Dave Cottlehuber added a comment -

        should have added that this requires admin access to DB or server to do this, its not a DoS opportunity. More like "rm -rf may cause premature data & job loss".

        Show
        Dave Cottlehuber added a comment - should have added that this requires admin access to DB or server to do this, its not a DoS opportunity. More like "rm -rf may cause premature data & job loss".
        Hide
        Dave Cottlehuber added a comment -

        Thanks Ronny for raising this!

        I don't see how we could deterministically detect this prior to storing the updated ddoc (halting pb).
        The question then is can the rewriter track number of traverses and eventually die?
        Or do we mark as DNF and note in the appropriate place that you can easily shoot yourself in the foot here?

        Show
        Dave Cottlehuber added a comment - Thanks Ronny for raising this! I don't see how we could deterministically detect this prior to storing the updated ddoc (halting pb). The question then is can the rewriter track number of traverses and eventually die? Or do we mark as DNF and note in the appropriate place that you can easily shoot yourself in the foot here?

          People

          • Assignee:
            Unassigned
            Reporter:
            Ronny Pfannschmidt
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development