couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Goodall <>
Subject Intermittent view failure
Date Thu, 10 Jun 2010 09:49:57 GMT

An application test started "randomly" failing when getting a
relatively simple map view. Here's the error from the couchdb logs:

[info] [<0.459.0>] - - 'PUT' /killer 201
[info] [<0.460.0>] - - 'POST' /killer 201
[info] [<0.468.0>] - - 'POST' /killer 201
[error] [<0.469.0>] Uncaught error in HTTP request: {exit,
[info] [<0.469.0>] Stacktrace: [{gen_server,call,3},
[info] [<0.469.0>] - - 'GET' /killer/_design/killer/_view/killer 500

I've managed to whittle the test down to a simple failing script that
only depends on curl:

set -e
while `true`; do
   curl -s $db -X DELETE > /dev/null
   curl -fs $db -X PUT > /dev/null
   curl -fs $db -X POST -d @- > /dev/null << EOF
   "_id": "_design/killer",
   "views": {
       "killer": {
           "map": "function(doc) {emit(null, null);}"
   curl -fs $db -X POST -d {} > /dev/null
   curl -fs $db/_design/killer/_view/killer

After running for some period of time the server dies with the above
error. Unfortunately, "some period of time" is not very consistent.
I've seen it die after as few as 5 loops and as many as 1500, but it
does eventually die for me.

Some interesting points:

* The view returns the same error from then on.
* The database's _design directory does not get created.
* CouchDB does not log any view build checkpoints.
* Restarting couchdb fixes things. The _design directory gets created
and the view is built.
* Updating the design doc fixes it.
* Adding a new document does not fix it.
* Deliberately killing the view server does not fix it. CouchDB
doesn't even bother starting a new one.
* I've now seen this error on three machines (a netbook, a decent
laptop, and a decent server).
* The same error occurred with CouchDB 0.11.0 and latest 0.11.x when
running the tests that first demonstrated the problem. However, I
haven't run the above script against 0.11.0 yet.

It's as if CouchDB thinks the view is up to date when, in fact, it
hasn't even been created. I'm guessing there's some race condition in
creating the _design directory or after updating a design doc but
that's pure speculation.

Anyway, I'm going to do a bit more playing here but I thought I'd get
my initial findings "out there" in case anyone recognised where the
issue may be.

- Matt

View raw message