[CSHARP-53] MapReduce on 1M documents collection using C# driver gives timeout. Created: 23/Jul/10  Updated: 19/Oct/16  Resolved: 11/Nov/10

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

Type: Bug Priority: Major - P3
Reporter: Pen Fold Assignee: Sam Corder
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Win32



 Description   

Using MongoDB-CSharp driver to carryout a MapReduce on a collection of 1M documents leads to a network connection timeout.

The mapreduce does run to completion but a timeout exception is displayed in the driver. [Chaning the timeout from default to 120 still leads to a timeout.]

Is this a problem with the db? Should it immediately return? With the client polling for progress?

Or is there an issue with driver?



 Comments   
Comment by Steve Wagner [ 11/Nov/10 ]

Please report here back https://github.com/mongodb-csharp/mongodb-csharp/issues if this still is not fixed.

Comment by Steve Wagner [ 28/Sep/10 ]

Hi Pen, could you check that again on our latest codebase at http://github.com/mongodb-csharp/mongodb-csharp?

Comment by Craig Wilson [ 27/Jul/10 ]

Someone more knowledgable than me with the connection stuff will need to look at this.

Comment by Pen Fold [ 27/Jul/10 ]

Any ideas?

Comment by Pen Fold [ 25/Jul/10 ]

Here is a snippet from my prototype:

....
MapReduce mr = dbSampleCollection.MapReduce()
.Map(@"function() { emit(this.SampleId,

{ matches: 2 }

); }")
.Reduce(@"function(key, values)

{ return values[0] }

").Out("Search004").KeepTemp(true);

foreach (Document document in mr.Documents)
{
Console.WriteLine(document.Id);
}
....

The query is long running (~2 -3 mins). Its as though the server is waiting for the mapreduce to complete before even sending some form of ack or the results.

Is the mechanism that the driver uses to query long running queries incorrect or is the route cause the db not sending a keep-alive response?

Comment by Steve Wagner [ 25/Jul/10 ]

That is simply the line which reads the response from the server, so it looks like that the server dose not send an answer.

Can you give us more information about how the query looks like?

Comment by Pen Fold [ 24/Jul/10 ]

The line that fails on an IOException timeout is:

reply.Read(_connection.GetStream());

Here is the call stack:

MongoDB.dll!MongoDB.Connections.Connection.SendTwoWayMessageCore<MongoDB.Document>(MongoDB.Protocol.IRequestMessage message =

{MongoDB.Protocol.QueryMessage}

, MongoDB.Bson.BsonReaderSettings readerSettings =

{MongoDB.Bson.BsonReaderSettings}

) Line 111
MongoDB.dll!MongoDB.Connections.Connection.SendCommandCore<MongoDB.Document>(MongoDB.Serialization.ISerializationFactory factory =

{MongoDB.Serialization.SerializationFactory}, string database = "Db005", System.Type rootType = {Name = "Sample" FullName = "MongoPrototype.Sample"}, object command = { "mapreduce": "Samples", "verbose": true, "map": { "$code": "function() { emit(this.SampleId, { matches: 2 })}" }, "reduce": { "$code": "function(key, values) { return values[0] }" }, "out": "Search004", "keeptemp": true }) Line 289 + 0x54 bytes
MongoDB.dll!MongoDB.Connections.Connection.SendCommand(MongoDB.Serialization.ISerializationFactory factory = {MongoDB.Serialization.SerializationFactory}

, string database = "Db005", System.Type rootType =

{Name = "Sample" FullName = "MongoPrototype.Sample"}, MongoDB.Document command = { "mapreduce": "Samples", "verbose": true, "map": { "$code": "function() { emit(this.SampleId, { matches: 2 })}" }, "reduce": { "$code": "function(key, values) { return values[0] }" }, "out": "Search004", "keeptemp": true }) Line 226 + 0x19 bytes
MongoDB.dll!MongoDB.MongoDatabase.SendCommand(System.Type rootType = {Name = "Sample" FullName = "MongoPrototype.Sample"}

, MongoDB.Document command = { "mapreduce": "Samples", "verbose": true, "map": { "$code": "function() { emit(this.SampleId,

{ matches: 2 }

)}" }, "reduce": { "$code": "function(key, values)

{ return values[0] }

" }, "out": "Search004", "keeptemp": true }) Line 273 + 0x3a bytes
MongoDB.dll!MongoDB.MapReduce.RetrieveData() Line 243 + 0x3f bytes
MongoDB.dll!MongoDB.MapReduce.get_Documents() Line 67 + 0xd bytes
MongoPrototype.exe!MongoPrototype.Program.Main(string[] args =

{string[0]}

) Line 30 + 0x6e bytes

Comment by Pen Fold [ 23/Jul/10 ]

Using MongoDB-CSharp 0.90.0.1.

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