no response from findandmodify

26 views
Skip to first unread message

nic...@nickyintheclouds.com

unread,
Apr 23, 2012, 5:58:53 AM4/23/12
to mongodb-user
Hi,

I'm currently using php 5 with the native MongoDB library and I've got
some troubles with the findandmodify command. I've 3 servers which
check a mongodb collection on the mongo server to get a task to do.
I'm using findandmodify command through db->command(...) in php. As
there are 3 servers, I use that command to do a transaction like
query.

However, sometimes the command does not respond and when I launch the
same query directly on the mongo server I do not have any answer, it
is waiting. Does it mean that a previous findandmodify query did not
finish correctly ?

When I restart the mongo service, the findandmodify query works again.

Any idea on the reason of the findandmodify lock ?

Thanks for your help,

Regards

Adam C

unread,
Apr 23, 2012, 6:42:16 AM4/23/12
to mongod...@googlegroups.com
Can you run db.currentOp() when you have the findAndModify running/not responding and post the results?

That will show you what is running on the mongod and what state it is in.  If the original command (from PHP) is still running, the operation run on the server will not return until it releases its lock.  Normally long running ops will yield and allow other operations to happen but this is not the case with findAndModify.

Adam.
Reply all
Reply to author
Forward
0 new messages