1

Our IIS is crashing at regular intervals and we have made a crash dump through DebugDiag that we are investigating.

The exception code is always e053534f which I believe is a stack overflow so have been looking at the stacktraces to find an infinite loop of some kind. Two different stack traces occur:

System.Web.VirtualPath.Create(System.String, System.Web.VirtualPathOptions)
System.Web.VirtualPathUtility.ToAppRelative(System.String)
Company.AssemblyResourceProvider.IsAppResourcePath(System.String)
Company.AssemblyResourceProvider.GetCacheDependency(System.String, System.Collections.IEnumerable, System.DateTime)
System.Web.Hosting.VirtualPathProvider.GetCacheDependency(System.String, System.Collections.IEnumerable, System.DateTime)
Company.AssemblyResourceProvider.GetCacheDependency(System.String, System.Collections.IEnumerable, System.DateTime)
System.Web.Hosting.VirtualPathProvider.GetCacheDependency(System.String, System.Collections.IEnumerable, System.DateTime)

And

System.Web.Hosting.MapPathBasedVirtualPathProvider.GetFile(System.String)
Company.AssemblyResourceProvider.GetFile(System.String)
Company.AssemblyResourceProvider.GetFile(System.String)
Company.AssemblyResourceProvider.GetFile(System.String)

The code for AssemblyResourceProvider can be seen below.

public class AssemblyResourceProvider : System.Web.Hosting.VirtualPathProvider  
{
    public AssemblyResourceProvider() {}
    private bool IsAppResourcePath(string virtualPath)
    {
        String checkPath =
           VirtualPathUtility.ToAppRelative(virtualPath);
        return checkPath.StartsWith("~/App_Resource/", StringComparison.InvariantCultureIgnoreCase);
    }
    public override bool FileExists(string virtualPath)
    {
        return (IsAppResourcePath(virtualPath) || base.FileExists(virtualPath));
    }
    public override VirtualFile GetFile(string virtualPath)
    {
        if (IsAppResourcePath(virtualPath))
            return new AssemblyResourceVirtualFile(virtualPath);                
        else
            return base.GetFile(virtualPath);
    }
    public override System.Web.Caching.CacheDependency GetCacheDependency(string virtualPath, System.Collections.IEnumerable virtualPathDependencies, DateTime utcStart)
    {
        if (IsAppResourcePath(virtualPath))
            return null;
        else 
            return base.GetCacheDependency(virtualPath, virtualPathDependencies, utcStart);
    }
}

I am unable to reproduce the error on any development setup so this is all I have to go on.

My own theory is that I should replace the base. with Previous. but looking at the code of VirtualPathProvider from MS that one seems to just wrap calls to Previous anyway. Without being able to reproduce locally I am left with just making that change, push to live and see what happens.

I am hoping someone here will be able to explain why the loops are happening.

UPDATE 1

Had another crash and dump file which recorded a third variant of the stack trace:

System.Web.Hosting.MapPathBasedVirtualPathProvider.GetFile(System.String)
Company.AssemblyResourceProvider.GetFile(System.String)
System.Web.VirtualPathUtility.ToAppRelative(System.String)
Company.AssemblyResourceProvider.GetFile(System.String)
System.Web.VirtualPathUtility.ToAppRelative(System.String)
Company.AssemblyResourceProvider.GetFile(System.String)
System.Web.VirtualPathUtility.ToAppRelative(System.String)

UPDATE 2

Attempting to use Previous. instead of Base. did not resolve anything.

LarsHJ
  • 205
  • 1
  • 11

0 Answers0