0

I am trying to run an aggregation pipeline using node.js and mongodb native driver on a sharded mongodb cluster with 2 shards. The monogdb ver. is 2.6.1. The operation runs for about 50 minutes and throws the error 'errmsg" : "exception: getMore: cursor didn't exist on server, possible restart or timeout?"' On googling I came across this link . It looks like the issue is not resolved yet. BTW, the size of the collection is about 140 million documents.

Is there a fix/workaround for this issue?

Here is the pipeline that I am trying to run. I don't know at what stage it breaks. It runs for about 50 minutes and the error happens. Same is the case with any aggregation pipeline that I try to run.

db.collection01.aggregate([
  {$match:{"state_cd":"CA"}}, 
  {$group : {"_id": "$pat_id" , count : {$sum : 1}}} 
],
{out: "distinct_patid_count", allowDiskUse: true }
)
Vince Bowdren
  • 8,326
  • 3
  • 31
  • 56
Param
  • 1
  • 1
  • I don't know of a generic workaround I want to recommend for you, but if you're willing to share detail about the pipeline and if you can identify at which stage the error occurs then I'll try and see if I have any ideas. – wdberkeley Aug 07 '14 at 17:53
  • Here is the pipeline that I am trying to run. I don't know at what stage it breaks. It runs for about 50 minutes and the error happens. Same is the case with any aggregation pipeline that I try to run. db.collection01.aggregate( [{$match:{"state_cd":"CA"}}, {$group : {"_id": "$pat_id" , count : {$sum : 1}}} ], {out: "distinct_patid_count", allowDiskUse: true } ) – Param Aug 12 '14 at 15:37

1 Answers1

0

My guess is you could try to lower the batch size to make the cursor more "active". I came across this error after our server was running for more than 2.5 months. Mongo started dropping cursors even before the timeout (I guess some sort of memory error), restart of mongo solved our problem.

pkopac
  • 986
  • 1
  • 13
  • 21