Uploaded image for project: 'CouchDB'
  1. CouchDB
  2. COUCHDB-1100

Server doesn't release HTTP connection when client queries a currently updating view and times out

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Won't Fix
    • 1.0.2
    • None
    • None
    • None

    Description

      If a client queries a view that is currently updating (without stale=ok), and then closes the connection after a timeout, the resources on the server side are not released (until the view update completes).

      If the view update takes a long time, the server will eventually run out of file descriptors (or if the file descriptor limit is very large, runs out of something else; not quite sure what).

      Steps to reproduce the problem:

      1) set "ulimit -n" for couchdb to 1024 (often the default). Using a much larger limit seems to result in different behavior (possibly CouchDB runs out of some other resource before file descriptors; not sure what).

      2) create a database with a view and sufficient number of docs so that generating the view from scratch takes a lot of time

      3) query the view repeatedly with a short timeout: for example in bash:
      while true; do curl -m1 'http://127.0.0.1:5984/grande/_design/testviews/_view/byDate1?limit=1'; done

      4) monitor the number of sockets used with e.g. "netstat -an | grep 5984 | grep CLOSE_WAIT". This should increase all the time.

      5) roughly when the number hits 1K, couchdb stops responding completely, and there's large number of error messages written to the log file.

      Attachments

        Activity

          People

            Unassigned Unassigned
            peronen Pasi Eronen
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: