Exception thrown from DefaultJsonStreamReader.ReadObjectAsync
System.IO.IOException
HResult=0x80131620
Message=L'opération de lecture a échoué, consultez l'exception interne.
Source=System.Net.Http
StackTrace:
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.
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)
{
Console.WriteLine(row);
}
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.
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();