I have the same issue when doing batch queries. I do reads from
This is using the latest Mongoid and mongo driver 1.5.1. What could be
intervals. At random the queries fail with the CURSOR_NOT_FOUND
exception. The collection changes frequently and causes documents to
On Feb 9, 1:34 am, Durran Jordan <
dur...@gmail.com> wrote:
> The cursor refresh is not handled by Mongoid, but by the driver itself.
> There's a couple things that may be happening here, which I'll lay out but
> I cannot be exactly sure if it's the problem you are having...
>
> 1. Are you using replica sets and reading from secondary? Cursors are on a
> per server basis, and when the driver asks to get more documents it needs
> to hit the same secondary replica set that it hit before. The 1.4.x drivers
> had problems with this since they were asking for cursors on different
> nodes than the original query, so I'd make sure you're on 1.5.x.
>
> 2. Cursors on the server time out after 10 minutes if not exhausted
> completely. Is this process taking over 10? I would recommend for batch
> jobs of this size that you drop down to the driver directly if possible and
> pass timeout: false to find and do your magic in that block.
>
> 3. With Mongoid 3 and Moped you wont see these types of issues, Moped's
> handling these cases under the covers, so the retry, refresh, timeout
> options won't be necessary. But I'd go with option 2 until then.
>