Ask questionsUnexpected end of request content k8s pod
We have been intermittently seeing issues with our Pod hosted service on a k8s cluster where for a fraction of the requests we start seeing this exception.
I want to understand 2 things -
What could be the possible reasons for this happening in our scenario? What is the best way to debug this issue ? Here is the callstack from the exception message： Unexpected end of request content.
at Microsoft.AspNetCore.Server.Kestrel.Core.BadHttpRequestException.Throw(RequestRejectionReason reason) at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.Http1ContentLengthMessageBody.ReadAsyncInternal(CancellationToken cancellationToken) at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpRequestStream.ReadAsyncInternal(Memory`1 buffer, CancellationToken cancellationToken) at System.IO.StreamReader.ReadBufferAsync() at System.IO.StreamReader.ReadToEndAsyncInternal()
Answer questions anurse
Can you provide a network trace using a tool like Wireshark? (If it's difficult to get one from the server side, you could try getting one from the client)
This generally indicates a malformed request from the client, possibly because the client disconnected while transmitting the body. Do you have a proxy or front-end in place (k8s ingress perhaps?)