what woud cause this middleware to randomly fail

I added a middleware to my application, and somehow it randomly succeed or fail.

Is there any issues with this code?:

                var requestBodyStream = new MemoryStream();
                var originalRequestBody = context.Request.Body;

                var bodyStream = context.Response.Body;
                var responseBodyStream = new MemoryStream();
                context.Response.Body = responseBodyStream;

                await context.Request.Body.CopyToAsync(requestBodyStream);
                requestBodyStream.Seek(0, SeekOrigin.Begin);

                var url = context.Request.GetDisplayUrl();
                var requestBodyText = new StreamReader(requestBodyStream).ReadToEnd();

                var startDate = DateTime.UtcNow;

                _logger.LogIncomingHttpRequest(context.Request, url, requestBodyText);

                requestBodyStream.Seek(0, SeekOrigin.Begin);
                context.Request.Body = requestBodyStream;
                await _next.Invoke(context);

                context.Request.Body = originalRequestBody;

                responseBodyStream.Seek(0, SeekOrigin.Begin);
                var responseBody = new StreamReader(responseBodyStream).ReadToEnd();

                _logger.LogIncomingHttpResponse(startDate, context.Response, responseBody);

                responseBodyStream.Seek(0, SeekOrigin.Begin);
                await responseBodyStream.CopyToAsync(bodyStream);

Here's the exception that I'd get when it fails:

 "Microsoft.AspNetCore.Server.Kestrel.Core.BadHttpRequestException: Reading the request body timed out due to data arriving too slowly. See MinRequestBodyDataRate.