Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MongoDB: Getting "Client Cursor::yield can't unlock b/c of recursive lock" warning when use findAndModify in two process instances

Tags:

mongodb

I'm using: MongoDB 1.6.4, Python 2.6.6, PyMongo 1.9, Ubuntu 10.10

I'm getting "Client Cursor::yield can't unlock b/c of recursive lock" warning in my logs very often when use findAndModify in two process instances. When I use only one process warning doesn't appear.

How can I fix this?

**Update 8 March 2013 **

Is there a fix to this problem as of now?

like image 579
Andrey Nikishaev Avatar asked Jan 21 '11 11:01

Andrey Nikishaev


2 Answers

this is usually means you are missing indexes on fields used in query.

I don't know tech details of this warning but from my experience adding index on the query field helps. check you have index on fields that used in query part of findAndModify. also run db.collection.find().explain() to check if it uses the index.

Thanks to the pingw33n who help solve this question.

like image 118
Andrey Nikishaev Avatar answered Oct 04 '22 14:10

Andrey Nikishaev


The Mongo folks say that you can ignore this warning -- see this thread. It deals with 2 processes trying to access a mutex (hence you only see it with multi process instances)

We're definitely aware of the issue -- we're discussing the best way to handle those messages going forward. The spurious log entries should be eliminated in a new release very shortly.

Regarding @Creotiv answer. Yeah, if something is slow -- 90% of the time you are missing an index

like image 32
Jonathan Avatar answered Oct 04 '22 15:10

Jonathan