andrewdavey / andrewdavey/cassette

Cached Manifest.xml being empty breaks website

Ouverte
#481 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
C#
Étoiles
531
Forks
139
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

We've had a production system down for a couple weeks now that traced back to a failing assumption in Cassette. Its _not the fault_ of Cassette, but just an obscurity that repeatedly failed to clean itself up. It all started when the site's drive filled and, it appears, the cached Manifest.xml was created as an empty file. Its off in a corner of the system with a path like : `C:\ProgramData\IsolatedStorage\u3ppbmt4.yyp\h1rm2zob.w3v\Url.e4kb21nzmyiduzdwqklmohnseoizhjuj\AssemFiles\Manifest.xml` (on my system, the hash-style values change per-server, but there are only single folders. YMMV)

I've looked at the code around reading this file and see how it handles 'Does not exist' by returning a simple false. I'd have to suggest:
a) if the file's length is zero, or some other minimal size, you should also ignore it (delete it?) and return false.
b) handle the XmlException better.
* You could catch and throw a wrapped exception naming the file (that probably exposes unnecessary system info?).
* You could catch it and write to the System Event Log that reading the file (with path) failed. Still ugly, but provides enough information for a SysAdmin to find it in a couple minutes.
* You could catch the exception, then simply delete the invalid file and return false rather then propagating the exception. I think this is what I'd recommend -- though the System Event Log could also be written.

Thanks for the consideration of this.

Zym

`Root element is missing.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Xml.XmlException: Root element is missing.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[XmlException: Root element is missing.]
System.Xml.XmlTextReaderImpl.Throw(Exception e) +72
System.Xml.XmlTextReaderImpl.ParseDocumentContent() +5469911
System.Xml.XmlTextReaderImpl.Read() +163
System.Xml.Linq.XDocument.Load(XmlReader reader, LoadOptions options) +44
Cassette.Aspnet.WebHostSettingsConfiguration.IsStaticCacheManifest(CassetteSettings settings) +106
Cassette.Aspnet.WebHostSettingsConfiguration.Configure(CassetteSettings settings) +221
Cassette.ConfigurationEnumerableExtensions.Configure(IEnumerable`1 configurations, T configurable) +151
Cassette.CassetteSettings..ctor(IEnumerable`1 configurations) +33

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) +0
System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +180
Cassette.TinyIoC.TinyIoCContainer.ConstructType(Type requestedType, Type implementationType, ConstructorInfo constructor, NamedParameterOverloads parameters, ResolveOptions options) +669

[TinyIoCResolutionException: Unable to resolve type: Cassette.CassetteSettings]
Cassette.TinyIoC.TinyIoCContainer.ConstructType(Type requestedType, Type implementationType, ConstructorInfo constructor, NamedParameterOverloads parameters, ResolveOptions options) +704
Cassette.TinyIoC.SingletonFactory.GetObject(Type requestedType, TinyIoCContainer container, NamedParameterOverloads parameters, ResolveOptions options) +124
Cassette.TinyIoC.TinyIoCContainer.ResolveInternal(TypeRegistration registration, NamedParameterOverloads parameters, ResolveOptions options) +86
Cassette.TinyIoC.TinyIoCContainer.ConstructType(Type requestedType, Type implementationType, ConstructorInfo constructor, NamedParameterOverloads parameters, ResolveOptions options) +374

[TinyIoCResolutionException: Unable to resolve type: Cassette.FileSystemWatchingBundleRebuilder]
Cassette.TinyIoC.TinyIoCContainer.ConstructType(Type requestedType, Type implementationType, ConstructorInfo constructor, NamedParameterOverloads parameters, ResolveOptions options) +521
Cassette.TinyIoC.SingletonFactory.GetObject(Type requestedType, TinyIoCContainer container, NamedParameterOverloads parameters, ResolveOptions options) +124
Cassette.TinyIoC.TinyIoCContainer.ResolveInternal(TypeRegistration registration, NamedParameterOverloads parameters, ResolveOptions options) +86
Cassette.TinyIoC.TinyIoCContainer.b__45(TypeRegistration registration) +32
System.Linq.WhereSelectEnumerableIterator`2.MoveNext() +164
System.Linq.d__95`1.MoveNext() +176
Cassette.HostBase.RunStartUpTasks() +65
Cassette.HostBase.Initialize() +147
Cassette.Aspnet.CassetteHttpModule.InitWithoutTraceLogging() +34
Cassette.Aspnet.CassetteHttpModule.InitWithTraceLogging() +122
Cassette.Aspnet.CassetteHttpModule.Init(HttpApplication httpApplication) +121
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +536
System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +173
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +336
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +296

[HttpException (0x80004005): Unable to resolve type: Cassette.FileSystemWatchingBundleRebuilder]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +10043436
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +95
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254`

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.