[CSHARP-158] "Get more" cursor operation broken when talking to mongos with slaveOk=true Created: 27/Jan/11  Updated: 20/Mar/14  Resolved: 16/Feb/11

Status: Closed
Project: C# Driver
Component/s: None
Affects Version/s: 0.11
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Aristarkh Zagorodnikov Assignee: Robert Stam
Resolution: Cannot Reproduce Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

celestine-3 is an instance of mongos (nightly 27 Jan 2011) with one shard, referring to a replica set with 3 machines.
The replica set has database "test1" which contains "items" collection with 320000 documents.
Connecting to mongos with slaveOk=false or a a replica set underlying the mongos instance works fine even with slaveOk=true works fine.

The following code reads some records, then bails out with an exception (see below):
static void ReadTest()
{
try

{ const string connectionString = "mongodb://celestine-3/test1?slaveOk=true"; var database = MongoDatabase.Create(MongoUrl.Create(connectionString)); var items = database["items"]; var cursor = items.FindAll(); long sum = 0; foreach (var item in cursor) sum += item["v"].ToInt64(); }

catch (Exception ex)

{ Console.WriteLine(ex.ToString()); }

Console.ReadKey();
}

Exception:
MongoDB.Driver.MongoQueryException: Cursor not found.
at MongoDB.Driver.Internal.MongoReplyMessage`1.ReadFrom(BsonBuffer buffer) in Driver\Internal\MongoReplyMessage.cs
at MongoDB.Driver.Internal.MongoConnection.ReceiveMessage[TDocument](MongoServer server) in Driver\Internal\MongoConnection.cs
at MongoDB.Driver.Internal.MongoCursorEnumerator`1.GetReply(MongoRequestMessage message) in Driver\Internal\MongoCursorEnumerator.cs
at MongoDB.Driver.Internal.MongoCursorEnumerator`1.GetMore() in Driver\Internal\MongoCursorEnumerator.cs
at MongoDB.Driver.Internal.MongoCursorEnumerator`1.MoveNext() in Driver\Internal\MongoCursorEnumerator.cs
at mongotest.Program.ReadTest() in Program.cs:line 115



 Comments   
Comment by Robert Stam [ 16/Feb/11 ]

Thanks for the update.

Comment by Aristarkh Zagorodnikov [ 16/Feb/11 ]

Can't repro anymore after upgrading to newer mongos, might be some of the recent (or not-so-recent fixes). I think this can be closed now, thanks.

Comment by Aristarkh Zagorodnikov [ 27/Jan/11 ]

I'm not sure if it's actually a driver issue, check http://jira.mongodb.org/browse/SERVER-2411 (it's marked as resolved/fixed, but when using the latest master build the problem still persists).

Generated at Wed Feb 07 21:35:58 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.