|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Intermittent Failed to map the path errorGetting a strange error intermittently on one of our production sites and wondering whether you could shed some light on it. System.Exception: Exception thrown initializing DBSystemValues collection ---> System.Web.HttpException: Failed to map the path '/log/'. at System.Web.Hosting.ISAPIWorkerRequestInProcForIIS6.MapPathSlowUsingIISCore(String path) at System.Web.Hosting.ISAPIWorkerRequest.MapPath(String path) at System.Web.HttpRequest.MapPath(String virtualPath, String baseVirtualDir, Boolean allowCrossAppMapping) at System.Web.HttpRequest.MapPath(String virtualPath) As you can see we are initialising a little collection of important system items one of them being the log file path and we get this error. This only happens very occasionaly but is a little concerning. Wondering whether anyone else had noticed this MapPathSlowUsingIISCore error before? Thanks I think i figured out what's causing this, although i don't have a solution.
The problem is caused when a worker thread doesn't get destroyed when the application domain gets restarted. In our application the main thread of the app domain creates a second worker thread that reads a file every 10 seconds. The worker thread needs to call MapPath, which isn't normally available in a new thread, but i got around that by manually setting HttpContext.Current inside the worker thread. Here's a very simple cut down version of what's happening. Private Shared _httpContext As HttpContext Private Shared _workerThread As New Thread(AddressOf Run) Private Shared Sub StartWorkerThread() _httpContext = HttpContext.Current _workerThread.Start() End Sub Private Shared Sub Run() HttpContext.Current = _httpContext While (True) Try HttpContext.MapPath(_nextFile) DoSomething() Sleep(10000) Catch ex As ThreadAbortException Exit While End Try End While End Sub In development and testing it works fine. The problem only occurs on the production machine. It only happens sometimes, but when the app domain is restarted (editing web.config, or uploading a new dll), it seems as though the worker thread does not get a ThreadAbortException thrown in it. This means that the worker thread from the old app domain keeps running and trying to call mappath even though the everything else in the old app domain has been deleted. It's this old thread that causes the MapPathSlowUsingIISCore exception. In the mean time a new app domain, with a new worker thread, has started running and is operating fine, but the old worker thread is still ticking away in the background chewing up resources. So in summary. The MapPathSlowUsingIISCore exception is merely a side effect of worker threads not dying when the app domain is restarted. That's great, except now i have to figure out how to make sure the worker thread dies. Show quote "Matt" wrote: > Hi guys, > Getting a strange error intermittently on one of our production sites and > wondering whether you could shed some light on it. > > System.Exception: Exception thrown initializing DBSystemValues collection > ---> System.Web.HttpException: Failed to map the path '/log/'. > at > System.Web.Hosting.ISAPIWorkerRequestInProcForIIS6.MapPathSlowUsingIISCore(String path) > at System.Web.Hosting.ISAPIWorkerRequest.MapPath(String path) > at System.Web.HttpRequest.MapPath(String virtualPath, String > baseVirtualDir, Boolean allowCrossAppMapping) > at System.Web.HttpRequest.MapPath(String virtualPath) > > As you can see we are initialising a little collection of important system > items one of them being the log file path and we get this error. This only > happens very occasionaly but is a little concerning. > > Wondering whether anyone else had noticed this MapPathSlowUsingIISCore error > before? > > Thanks |
|||||||||||||||||||||||