[CSHARP-1558] Deadlock in Web Context Created: 09/Feb/16  Updated: 16/Nov/21  Resolved: 09/Feb/16

Status: Closed
Project: C# Driver
Component/s: GridFS
Affects Version/s: 2.2, 2.2.3
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Steven Ward Assignee: Unassigned
Resolution: Done Votes: 0
Labels: deadlock
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

ASP.Net WebApi



 Description   

There appears to be a deadlock when trying to find files in GridFS using the Async method.

var client = new MongoClient("whatever_connection_str");
var database = client.GetDatabase("your_db");
var bucket = new GridFSBucket(database, new GridFSBucketOptions

{ BucketName = "MyDocs" }

);
var builder = Builders<GridFSFileInfo>.Filter;

// userid is embedded in the metadata of the fileinfo, confirmed it's there and correct type etc
var filter = builder.Eq(info => info.Metadata["UserId"], <any_object_id>);
var files = await bucket.FindAsync(filter); <-- this deadlocks in ASP.Net

If you try the same code in a console app it works fine.



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

Thanks for letting us know.

Comment by Steven Ward [ 09/Feb/16 ]

This can be closed as a non-bug. The problem was much higher up in the stack where there was a missing await.

Weirdly, other awaits still worked and only this one deadlocked.

Works fine now though.

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