adams
adams

Reputation: 606

Mongo c# driver freezes and never returns a value on Update()

I have a long running operation that inserts thousands of sets of entries, each time a set is inserted using the code below. After a while of this code running, the collection.Update() method freezes (does not return) and the entire process grinds to a halt.

Can't find any reasonable explanation for this anywhere.

I've looked at the mongod logs, nothing unusual, it just stops receiving requests from this process.

Mongo version: 2.4.1, C# driver version: 1.8.0

using (_mongoServer.RequestStart(_database))    
{
    var collection = GetCollection<BsonDocument>(collectionName);

    // Iterate over all records
    foreach (var recordToInsert in recordsDescriptorsToInsert)
    {
        var query = new QueryDocument();
        var update = new UpdateBuilder();

        foreach (var property in recordToInsert)
        {
            var field = property.Item1;
            var value = BsonValue.Create(property.Item2);

            if (keys.Contains(field))
                query.Add(field, value);

            update.Set(field, value);
        }

        collection.Update(query, update, UpdateFlags.Upsert); // ** NEVER RETURNS **
    }
}

Upvotes: 2

Views: 1144

Answers (1)

SommerEngineering
SommerEngineering

Reputation: 1700

This is may related to this: CSHARP-717

It was fixed for driver 1.8.1

Upvotes: 1

Related Questions