ServiceStack / Issues

Issue Tracker for the commercial versions of ServiceStack
11 stars 8 forks source link

ServiceStack creating a redirection to the same URL? #759

Closed johnburkow closed 3 years ago

johnburkow commented 3 years ago

We have a large web application hosted by IIS. The REST backend consists of perhaps a few hundred endpoints. The REST backend uses the ServiceStack library for request handling.

The problem is that sometimes – during or after recycling of app pool – we have endpoints (2 out of a few hundred) returning code 404. The endpoints never “recover” until a new recycle is triggered (a few times, more than one recycle is required).

We can see in the IIS tracelogs that the requests are coming in but they return 404. We intercept and log all requests before being handled by servicestack but we cannot see any traces of the requests coming in here. A common denominator is that the endpoints that suddenly disappear are the ones most frequently used by clients and multiple requests will be waiting to be served during the time when recycling makes the application unavailable (Sometimes it takes more than 60 seconds to recycle the app pool due to all the initialization done on startup and several requests are then waiting in line).

For us it seems that under certain conditions IIS drops the endpoint/route and blocks it. We therefore contacted Microsoft for support on this, and they came back with their findings along with some questions that we are unable to answer. Therefore this question on github.

Microsoft has replied with the following findings to us based on the "failed request logging” in IIS:

  1. The request was first handled by extenslessurlhandler in the first place as usual
  2. Later there was child request initiated from the application itself with the same url. and it's weird that the child request for the same url is handled by staticfilehandler
  3. Hence the application tries to access a file that does not exist which will cause a 404 error.

Does anybody know if ServiceStack is the component that - for some special reason - creates the redirection to the same URL?

No. EventName Details
1. GENERAL_REQUEST_START SiteId="1", AppPoolId="OurSite.PortalPool", ConnId="1610629160", RawConnId="0", RequestURL="https://customer.us.com:443/Us.Services/api/measurements", RequestVerb="POST"
  1. | HANDLER_CHANGED | OldHandlerName="", NewHandlerName="ExtensionlessUrlHandler-Integrated-4.0", NewHandlerModules="ManagedPipelineHandler", NewHandlerScriptProcessor="", NewHandlerType="System.Web.Handlers.TransferRequestHandler"

  2. | GENERAL_CHILD_REQUEST_START | SiteId="1", RequestURL="https://customer.us.com:443/Us.Services/api/measurements", RequestVerb="POST", RecursiveLevel="1"

  3. | HANDLER_CHANGED | OldHandlerName="", NewHandlerName="StaticFile", NewHandlerModules="StaticFileModule,DefaultDocumentModule,DirectoryListingModule", NewHandlerScriptProcessor="", NewHandlerType=""

  4. | MODULE_SET_RESPONSE_ERROR_STATUS | ModuleName="IIS Web Core", Notification="MAP_REQUEST_HANDLER", HttpStatus="404", HttpReason="Not Found", HttpSubStatus="0", ErrorCode="The system cannot find the file specified.  (0x80070002)", ConfigExceptionInfo=""

Any help/hints on this is much appreciated.

Layoric commented 3 years ago

Hi @johnburkow , there isn't much to go on here and hard to tell if the issue is related to ServiceStack.

See the Issues README regarding raising an issue and details required, specifically "How to create a good Bug Report?". This Issue tracker is for reporting reproducible bugs/issues only.

Closing this issue here, but If you re-post the problem on the customer forums or raise a support incident with us, be sure to provide version info of ServiceStack itself as well as related major components. In this case, eg OS host version, IIS version, etc along with configuration information for your ServiceStack host, IIS and any other routing related products. The more info to help others reproduce the issue, the more likely people might be able to help you find the root cause of the problem.