Closed
Description
Hi,
I'm using the driver in a ASP.NET Core Web API (net5.0) project. The Context is registered in the Startup.cs file by using the dependency injection extensions provided in this repo.
Everything runs fine but when I'm generating 1000 requests accessing the same Web API endpoint in parallel I'm facing some 400 Bad Request responses from CouchDB.
I'm seeing broken CouchDB requests generated by the driver.
Is this an issue in the driver code handling parallel calls not well or am I doing something wrong?
This is an partial output of the broken generated CouchDB request bodies by using the AfterCall hook:
http://192.168.142.41:5984/lp_identity_role_type/_find
{"limit":2147483647,"selector":{}}"limit":2147483647,"selector":{}}
http://192.168.142.41:5984/lp_identity_role_type/_find
{"limit":2147483647,"selector":{}}"limit":2147483647,"selector":{}}
http://192.168.142.41:5984/lp_identity_role_type/_find
"limit":2147483647,"selector":{}}
http://192.168.142.41:5984/lp_identity_role_type/_find
"limit":2147483647,"selector":{}}"limit":2147483647,"selector":{}}
http://192.168.142.41:5984/lp_identity_role_type/_find
{
http://192.168.142.41:5984/lp_identity_role_type/_find
{"limit":2147483647,"selector":{}}"limit":2147483647,"selector":{}}
This is the Context registration in the Startup.cs:
services.AddCouchContext<Context>(options =>
{
options
.UseEndpoint(dbEndpoint)
.UseBasicAuthentication(dbUsername, dbPassword)
.EnsureDatabaseExists()
.DisableDocumentPluralization()
.ConfigureFlurlClient(settings =>
{
settings.AfterCall = OnAfterCall;
});
});
This the controller method that will be hit with 1000 requests in parallel:
[HttpGet]
public async Task<IActionResult> GetAllTypesAsync()
{
var types = await Data.RoleTypes
.Take(int.MaxValue)
.ToListAsync();
return Ok(RoleTypeMapper.Map(types));
}