You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
In our .net framework web app, targeting .net framework 4.8
To Reproduce
Steps to reproduce the behavior:
Create a controller that implements System.Web.Http.ApiController
Add and setup using default settings the Elastic.Apm.AspNetFullFramework v1.7.1 nuget package
Make an async controller endpoint that makes a multipart async read await Request.Content.ReadAsMultipartAsync();
Expected behavior
I expect APM not to interfere with reading multipart async request streams, especially when we don't have Body capturing enabled.
Here is a stripped down stack trace:
Error reading MIME multipart body part.
System.IO.IOException: Error reading MIME multipart body part. [Source: System.Net.Http.Formatting]
at System.Net.Http.HttpContentMultipartExtensions.d__9`1.MoveNext() --- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at <internal Service>.d__0.MoveNext() in <path to internal service source file>:line 14 --- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at <internal ApiController>.d__8.MoveNext() in <path to internal ApiController source file>:line 77
Inner Exception:
System.InvalidOperationException: Unable to read the entity body in Bufferless mode. The request stream has already been buffered. [Source: System.Web.Http.WebHost]
at System.Web.Http.WebHost.HttpControllerHandler.<>c__DisplayClass18_0.b__1()
at System.Web.Http.WebHost.HttpControllerHandler.LazyStreamContent.get_StreamContent()
at System.Web.Http.WebHost.HttpControllerHandler.LazyStreamContent.CreateContentReadStreamAsync()
at System.Net.Http.HttpContent.ReadAsStreamAsync()
at System.Net.Http.HttpContentMultipartExtensions.d__9`1.MoveNext()
Endpoint example
[Route]
public async Task<IHttpActionResult> Post()
{
var content = await Request.Content.ReadAsMultipartAsync(); //exception gets thrown here
return Ok(content.ToString());
}
The text was updated successfully, but these errors were encountered:
This commit fixes a bug where accessing the Request.InputStream
causes the entrie request to be buffered in memory. This has
two repercussions:
1. For many large requests, it can potentially cause out of memory
2. It can interfere with a custom IHostBufferPolicySelector used in
web API to determine whether to buffer the input stream.
With this fix, the input stream is accessed only when
a SOAP content-type is present and has not already been
read bufferless.
Fixeselastic#1113
This commit fixes a bug where accessing the Request.InputStream
causes the entrie request to be buffered in memory. This has
two repercussions:
1. For many large requests, it can potentially cause out of memory
2. It can interfere with a custom IHostBufferPolicySelector used in
web API to determine whether to buffer the input stream.
With this fix, the input stream is accessed only when
a SOAP content-type is present and has not already been
read bufferless.
Fixes#1113
Describe the bug
In our .net framework web app, targeting .net framework 4.8
To Reproduce
Steps to reproduce the behavior:
await Request.Content.ReadAsMultipartAsync();
Expected behavior
I expect APM not to interfere with reading multipart async request streams, especially when we don't have Body capturing enabled.
Here is a stripped down stack trace:
Endpoint example
The text was updated successfully, but these errors were encountered: