Hi, we have update the couchbase client package from 3.4.4 to 3.4.8 and now we have a crash
I’ve investiguated the issue
It’s related to this commit: https://review.couchbase.org/c/couchbase-net-client/+/190910
You have introduced HttpCompletionOption.ResponseHeadersRead
But when you try to read a response without content it crashes with an IOException
Exception thrown from DefaultJsonStreamReader.ReadObjectAsync
Message=L'opération de lecture a échoué, consultez l'exception interne.
at System.Net.Http.HttpClientHandler.WebExceptionWrapperStream.Read(Byte buffer, Int32 offset, Int32 count) in f:\dd\NDP\fx\src\net\System\Net\Http\HttpClientHandler.cs:line 1305
This exception was originally thrown at this call stack:
System.Net.ConnectStream.Read(byte, int, int) in ConnectStream.cs
System.Net.Http.HttpClientHandler.WebExceptionWrapperStream.Read(byte, int, int) in HttpClientHandler.cs
Inner Exception 1:
WebException: La demande a été abandonnée : La demande a été annulée.
Are you sure that the response doesn’t have content, or does just it just have no ContentLength? I wouldn’t expect this endpoint to return an empty body. We expect the data to be transferred using Chunked encoding with an unknown length since the query is not yet complete so data size is not known when headers are written.
Also, what version of .NET Framework or .NET are you using? It could be a framework-specific issue.
We are using .net Framework 4.8
We are using Framework 4.7.2 and also seeing the same problem. I’ve confirmed that removing the change mentioned above fixes it.
@dredmond @mdegroux -
Thanks for reporting, I created a ticket for fixing which will be in 3.4.9 to be released soon.
@dredmond / @mdegroux -
Can you provide an example usage? Doing something like:
var statement = "SELECT l.* FROM logs as l WHERE 1=2;";
var query = await cluster.QueryAsync<dynamic>(statement);
await foreach(var row in query.Rows)
Works for me on .NET 6; is this what you meant by “no content”? Note that the query returns an empty body
"" from the server.
Also, what OS version is the SDK running on?
I’m seeing “WebException: The request was aborted: The connection was closed unexpectedly.” happening inside DefaultJsonStreamReader.ReadToNextAttributeAsync(). This only happens when HttpCompletionOption.ResponseHeadersRead is used in the HttpClient.SendAsync(). If that option is removed everything works as expected.
I’m able to reproduce this fairly easily by just calling the following code. We have 2 indexes in our default collection, so in my case, I’m pretty sure it’s not “no content” like @mdegroux was saying. The following code works as expected if I switch back to Couchbase SDK 3.4.5
var indexes = (await DefaultCollection.QueryIndexes.GetAllIndexesAsync(GetAllQueryIndexOptions.Default).ConfigureAwait(false)).ToList();
What .NET version and OS are you running?
I’m using .NET Framework 4.7.2 and Windows 10
@dredmond /@mdegroux -
I attached a WIP patch to the ticket. You can download it and verify that it works.
The patch works for me. I’m no longer seeing IOExceptions.
Hi, I also tested the patch
No more issues in .net 4.8
Also tested in .net 7
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.