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

CouchDB 2.0: Race condition when creating/deleting database

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 2.0.0
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      I've noticed that CouchDB 2.0 (master) occasionally returns 500 errors when multiple clients attempt to PUT or DELETE the same database concurrently. This is reproducible by running multiple instances of following script in parallel against an n=1 (single node) cluster:

      #!/bin/bash
      
      for i in `seq 1 2000`;
      do
      	printf '\nPUT: '
          curl -XPUT 'http://localhost:15984/testdb' -w "%{http_code}\\n"
          printf '\nDELETE: '
          curl -XDELETE 'http://localhost:15984/testdb' -w "%{http_code}\\n"
      done
      

      This generates output along the lines of:

      PUT: {"ok":true}
      201
      
      DELETE: {"ok":true}
      200
      
      PUT: {"error":"error","reason":"internal_server_error"}
      500
      
      DELETE: {"error":"not_found","reason":"Database does not exist."}
      404
      
      PUT: {"error":"file_exists","reason":"The database could not be created, the file already exists."}
      412
      
      DELETE: {"ok":true}
      200
      
      PUT: {"error":"file_exists","reason":"The database could not be created, the file already exists."}
      412
      
      DELETE: {"ok":true}
      200
      
      PUT: {"ok":true}
      201
      
      DELETE: {"ok":true}
      200
      

      I can't reproduce the error against CouchDB 1.6 or CouchDB master on port 15986 (bypassing the clustering).

      1. node1.log
        192 kB
        Will Holley

        Activity

        Hide
        wilhol Will Holley added a comment -

        added CouchDB log file from the test run

        Show
        wilhol Will Holley added a comment - added CouchDB log file from the test run

          People

          • Assignee:
            Unassigned
            Reporter:
            wilhol Will Holley
          • Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:

              Development