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
        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?
        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
        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
        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

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development