Strange cursor not found error w/ ruby driver under load

849 views
Skip to first unread message

Paul Dlug

unread,
Jul 16, 2010, 10:34:10 AM7/16/10
to mongodb-user
I'm seeing a strange issue that I'm hoping someone can shed some light
on. I have a merb app with a mongo ruby driver that when deployed in
production started getting logging this error after a while:

Query response returned CURSOR_NOT_FOUND. Either an invalid cursor was
specified, or the cursor may have timed out on the server. -
(Mongo::OperationFailure)

When this would happen it would appear that the merb process locked up
and a restart was required. I was not able to replicate in development
and it does appear to take some time to get to this state (10-30
minutes depending on load). The code is just doing a single query to
the mongodb with the database connection in a class variable,
switching to opening/closing the connection after each request has
fixed the issue but this is non-optimal going forward.

This is with the latest mongo ruby driver (1.0.5 but built from github
last night since I thought the last checking regarding cursor closing
might be a fix), server is running 1.5.4, all are running on linux.

Any ideas?

Kyle Banker

unread,
Jul 16, 2010, 11:00:26 AM7/16/10
to mongod...@googlegroups.com
Paul,

In the short term, you may want to revert to 1.0.3, but I'd like to help you debug this.

Can you provide more information? What does your connection string look like? How are you deploying the app? Are you using the driver alone?  Can you also show the exact query that's happening?

Kyle


--
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To post to this group, send email to mongod...@googlegroups.com.
To unsubscribe from this group, send email to mongodb-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mongodb-user?hl=en.


Thijs Cadier

unread,
Aug 27, 2010, 10:38:22 AM8/27/10
to mongodb-user
We are currently experiencing the same issue.

db version v1.6.0, pdfile version 4.5

With the latest ruby driver and mongoid.

It happens every time at the exact same point in a very large query
(updating 200k+ records)


On Jul 16, 5:00 pm, Kyle Banker <k...@10gen.com> wrote:
> Paul,
>
> In the short term, you may want to revert to 1.0.3, but I'd like to help you
> debug this.
>
> Can you provide more information? What does your connection string look
> like? How are you deploying the app? Are you using the driver alone?  Can
> you also show the exact query that's happening?
>
> Kyle
>
> On Fri, Jul 16, 2010 at 10:34 AM, Paul Dlug <paul.d...@gmail.com> wrote:
> > I'm seeing a strange issue that I'm hoping someone can shed some light
> > on. I have a merb app with a mongo ruby driver that when deployed in
> > production started getting logging this error after a while:
>
> > Query response returned CURSOR_NOT_FOUND. Either an invalid cursor was
> > specified, or the cursor may have timed out on the server. -
> > (Mongo::OperationFailure)
>
> > When this would happen it would appear that the merb process locked up
> > and a restart was required. I was not able to replicate in development
> > and it does appear to take some time to get to this state (10-30
> > minutes depending on load). The code is just doing a single query to
> > the mongodb with the database connection in a class variable,
> > switching to opening/closing the connection after each request has
> > fixed the issue but this is non-optimal going forward.
>
> > This is with the latest mongo ruby driver (1.0.5 but built from github
> > last night since I thought the last checking regarding cursor closing
> > might be a fix), server is running 1.5.4, all are running on linux.
>
> > Any ideas?
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "mongodb-user" group.
> > To post to this group, send email to mongod...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > mongodb-user...@googlegroups.com<mongodb-user%2Bunsu...@googlegroups.com>
> > .

Eliot Horowitz

unread,
Aug 27, 2010, 10:39:47 AM8/27/10
to mongod...@googlegroups.com
Cursors timeout after 10 minutes of inactivity.

So if you are processing large amounts of data client side, this could hapen.

There are 2 solutions:
 - lower batch size so you go back to the server more often
 - use to NO_TIMEOUT option so the cursor never times out

To unsubscribe from this group, send email to mongodb-user...@googlegroups.com.

Michael Dirolf

unread,
Aug 27, 2010, 10:40:40 AM8/27/10
to mongod...@googlegroups.com
The problem is likely that the cursor is timing out, as the error
message specifies. You can turn timeout off for the query if you need
to keep the cursor open for a very long time.

On Fri, Aug 27, 2010 at 10:38 AM, Thijs Cadier <th...@80beans.com> wrote:

> To unsubscribe from this group, send email to mongodb-user...@googlegroups.com.

Kyle Banker

unread,
Aug 27, 2010, 11:36:19 AM8/27/10
to mongod...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages