.netcore context.Request.EnableRewind() throwing System.IO.Exception once buffer exceeds - asp.net-core-2.0

We have a production deployed application using netcoreapp2.0
We use context.Request.EnableRewind(); to read and log the request before processing.
Since few days intermittently we are getting below unhandled exception in kestrel hosted in AWS Docker ECS.
Basically our request size is more than 30 Kb that's why netcore trying to use filesystem buffer to rewind the request. And it is throwing File is readonly exception.
Is increasing the default buffer limit is the only way to fix the issue.
context.Request.EnableRewind([int bufferthreashold 30720],long? bufferLimit = null]);
Or there is any other way to configure request rewind ?
Option to upgrade to 2.1 is not possible for us right now. I see it is fixed in 2.1
2019-06-24 14:09:49[41m[30mfail[39m[22m[49m: Microsoft.AspNetCore.Server.Kestrel[13]
[41m[30mfail[39m[22m[49m: Microsoft.AspNetCore.Server.Kestrel[13]
2019-06-24 14:09:49 Connection id "0HLKCN30834Q0",
Request id "0HLKCN30834Q0:0003B777": An unhandled exception was thrown by the application.
Connection id "0HLKCN30834Q0", Request id "0HLKCN30834Q0:0003B777": An unhandled exception was thrown by the application.
2019-06-24 14:09:49System.IO.IOException: Read-only file system
System.IO.IOException: Read-only file system

Fixed it by increasing the default buffer size.

Related

Azure Functions Python BadHttpRequestException - Reading the request body timed out

We have deployed an Azure Function App with the Python 3.8 stack. For some requests, we have received a BadHttpRequestException
Exception while executing function: Functions.***
Exception binding parameter 'req' Reading the request body timed out
due to data arriving too slowly. See MinRequestBodyDataRate.
But this exception is thrown from ASP .Net core . We are not sure what is causing this exception, network connectivity seems to fine.
Is it something to do with request payload size, if it is big and it resulting in slowness.
In Python Http Trigger Azure function where do set the MinRequestBodyDataRate

Need help investigating Azure App Service .NET Core 2.1 ArgumentOutOfRangeException and System.OverflowException

Today I've adjusted the App Service Log settings for my Azure App Serivce: a .NET Core 2.1 Web API. Soon after I changed the Application Logging (file system) setting from Information to Warning, my application stopped responding. I immediately kicked of a .NET Trace using the Diagnose and solve problems feature.
This Trace report showed the following:
system.private.corelib!
microsoft.aspnetcore.hosting!
System.Private.CoreLib!System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start
microsoft.aspnetcore.hosting.il!Microsoft.AspNetCore.Hosting.Views.ErrorPage.ExecuteAsync
microsoft.aspnetcore.hosting!
System.Private.CoreLib!System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start
microsoft.aspnetcore.hosting.il!Microsoft.Extensions.RazorViews.BaseView.ExecuteAsync
microsoft.aspnetcore.hosting!
microsoft.aspnetcore.hosting!
System.Private.CoreLib!System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1+<>c[System.Threading.Tasks.VoidTaskResult,Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol+<ProcessRequests>d__188`1[Microsoft.AspNetCore.Hosting.Internal.HostingApplication+Context]].<.cctor>b__9_0
system.private.corelib!
System.Private.CoreLib!System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[System.Threading.Tasks.VoidTaskResult,Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol+<ProcessRequests>d__188`1[Microsoft.AspNetCore.Hosting.Internal.HostingApplication+Context]].MoveNext
system.private.corelib!
system.private.corelib!
system.private.corelib!
system.private.corelib!
system.private.corelib!
Same time, the Azure Blob log showed these lines:
2019-07-06 14:04:06.476 +00:00 [Error] Microsoft.AspNetCore.Server.Kestrel: Connection id "0HLO233NHLK6Q", Request id "0HLO233NHLK6Q:000003BF": An unhandled exception was thrown by the application.
System.OverflowException: Arithmetic operation resulted in an overflow.
at System.IO.StreamWriter.Write(String value)
at Microsoft.Extensions.RazorViews.BaseView.Write(String value)
at Microsoft.AspNetCore.Hosting.Views.ErrorPage.ExecuteAsync()
at Microsoft.Extensions.RazorViews.BaseView.ExecuteAsync(HttpContext context)
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication`1 application)
2019-07-06 14:04:19.245 +00:00 [Error] Microsoft.AspNetCore.Server.Kestrel: Connection id "0HLO233NHLK6T", Request id "0HLO233NHLK6T:000000EF": An unhandled exception was thrown by the application.
System.ArgumentOutOfRangeException: Index and count must refer to a location within the buffer.
Parameter name: chars
at System.Text.EncoderNLS.GetBytes(Char[] chars, Int32 charIndex, Int32 charCount, Byte[] bytes, Int32 byteIndex, Boolean flush)
at System.IO.StreamWriter.Flush(Boolean flushStream, Boolean flushEncoder)
at System.IO.StreamWriter.Write(String value)
at Microsoft.AspNetCore.Hosting.Views.ErrorPage.ExecuteAsync()
at Microsoft.Extensions.RazorViews.BaseView.ExecuteAsync(HttpContext context)
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication`1 application)
These stacktraces don't show any of my own code, they seem framework related.
Is there a message or a hint in these error stack traces that I can use to prevent these situations?
Many thanks in advance
I know it's too late but maybe my answer will help someone else.
I received the same exceptions as you. But it was not Azure App Service but IIS. The problem was in incorrect configuration somewhere in Startup.cs. You webhost tried to show error page but at the same time App Service (or IIS in my case) tried to shut down or restart it.
This thread helped me a lot https://github.com/aspnet/KestrelHttpServer/issues/1737

CoreData app not syncing with iCloud

I am running an iPad app on iOS7, XCode 6; I have the device iCloud enabled for Documents and the app enabled for iCloud. Nothing shows up in iCLoud when I run my app on the device and make changes to the Core Data store in the app (using MagicalRecord).
Is there something else I need to do? (I want to have device sharing and backup capabilities of the Core Data store using MagicalRecord)
UPDATE:
Made these changes:
(I was unable to check "JRSD9A598D" for a container)
and:
and this is line of code giving me a run-time error:
[MagicalRecord setupCoreDataStackWithiCloudContainer:#"rolfbucket" localStoreNamed:#"saori.sqlite"];
This is the error:
2014-11-05 07:53:15.156 SalonBook[223:1607] *** -[NSFileManager URLForUbiquityContainerIdentifier:]: An error occurred while getting ubiquity container URL: Error Domain=LibrarianErrorDomain Code=11 "The operation couldn’t be completed. (LibrarianErrorDomain error 11 - The requested container identifier is not permitted by the client's com.apple.developer.ubiquity-container-identifiers entitlement.)" UserInfo=0x1456bb50 {NSDescription=The requested container identifier is not permitted by the client's com.apple.developer.ubiquity-container-identifiers entitlement.}
I appear to be making progress, but what is causing this error?
The problem was I had picked the wrong container; it should have been the one with my bundle ID. Fixed that and the error went away.

Heroku/MongoLab not working

I ma using heroku and mongolab to host my node app.
So far everything had been working great but now everytime I try to access my mongolab dashboard from heroku I get the following 500 error:
HTTP Status 500 - Cannot call sendRedirect() after the response has been committed
type Exception report
message Cannot call sendRedirect() after the response has been committed
description The server encountered an internal error that prevented it from fulfilling this request.
exception
java.lang.IllegalStateException: Cannot call sendRedirect() after the response has been committed
org.apache.catalina.connector.ResponseFacade.sendRedirect(ResponseFacade.java:482)
javax.servlet.http.HttpServletResponseWrapper.sendRedirect(HttpServletResponseWrapper.java:137)
org.objectlabs.http.RedirectValidatingHttpServletResponseWrapper.sendValidatedRedirect(RedirectValidatingHttpServletResponseWrapper.java:77)
org.objectlabs.http.RedirectValidatingHttpServletResponseWrapper.sendRedirect(RedirectValidatingHttpServletResponseWrapper.java:51)
org.owasp.csrfguard.http.InterceptRedirectResponse.sendRedirect(InterceptRedirectResponse.java:59)
org.olabs.mongolabs.util.ErrorPage.doRedirectTo(ErrorPage.java:53)
org.olabs.mongolabs.util.ErrorPage.redirectTo(ErrorPage.java:32)
org.olabs.mongolabs.user.login.LoginGatekeeper.doFilter(LoginGatekeeper.java:63)
org.owasp.csrfguard.CsrfGuardFilter.doFilter(CsrfGuardFilter.java:79)
org.objectlabs.http.RedirectValidationFilter.doFilter(RedirectValidationFilter.java:20)
org.objectlabs.http.HttpFilter.doFilter(HttpFilter.java:23)
org.objectlabs.http.ClickjackingProtectionFilter.doFilter(ClickjackingProtectionFilter.java:68)
org.objectlabs.http.HttpFilter.doFilter(HttpFilter.java:23)
org.objectlabs.http.AddDefaultCharsetFilter.doFilter(AddDefaultCharsetFilter.java:50)
ch.qos.logback.classic.helpers.MDCInsertingServletFilter.doFilter(MDCInsertingServletFilter.java:51)
note The full stack trace of the root cause is available in the Apache Tomcat/7.0.52 logs.
Apache Tomcat/7.0.52
I am trying to access this url:
https://addons-sso.heroku.com/apps/my-app/addons/mongolab:sandbox
have I dont something wrong??
Apologies for the confusion. For your protection, we have expired all passwords after the heartbleed issue was announced this week and it appears that while you usually SSO in from Heroku you do actually have a password with us.
You appear to have hit an edge case with that code. You should be forced to your user info screen where you can update your password, but it appears you're tripping over an error. Could you write us at support#mongolab.com so that we can identify your account and work through the issue with you?

How to handle DNS-lookup failure to Azure Blob Storage

(I'm quite new to Windows Azure development, so I hope I'm using the right terms.)
We have an Azure Worker Role that is supposed to fetch data stored in Blob Storage.
Somehow we occasionally get the following error message:
Microsoft.WindowsAzure.StorageClient.StorageServerException: The server encountered an unknown failure: The remote name could not be resolved: 'XXX.blob.core.windows.net' ---> System.Net.WebException: The remote name could not be resolved: 'XXX.blob.core.windows.net'
This seems strange, since requests only a second before and/or after works as expected.
If I understand things correctly, the CloudBlob class has internal retry functionality. It seems that this is not considered as a "retryable" error. Is this perhaps handled by the Transient Error Handling Block (Topaz), or do we have to handle this specific error in some other way?

Resources