Exceptions in Error log

Jan 11, 2012 at 12:45 AM

Every time I load a page on my Orchard site I'm seeing multiple exceptions logged by Combinator in the App_Data\logs\orchard-error....log : 


2012-01-10 19:41:29,156 [11] Piedone.Combinator.CombinedResourceManager - Error when combining JavaScript files
System.ArgumentException: File -142036643-1.js already exists
   at Orchard.FileSystems.Media.FileSystemStorageProvider.CreateFile(String path) in C:\projects\OrchardEnlistments\1.x\src\Orchard\FileSystems\Media\FileSystemStorageProvider.cs:line 243
   at Piedone.Combinator.Services.CacheFileService.Save(Int32 hashCode, ISmartResource resource) in c:\projects\OrchardEnlistments\1.x\src\Orchard.Web\Modules\Piedone.Combinator\Services\CacheFileService.cs:line 73
   at Piedone.Combinator.Services.CombinatorService.<>c__DisplayClassc.b__b(ISmartResource combinedResource) in c:\projects\OrchardEnlistments\1.x\src\Orchard.Web\Modules\Piedone.Combinator\Services\CombinatorService.cs:line 134
   at Piedone.Combinator.Services.CombinatorService.Combine(IList`1 resources, Int32 hashCode, ResourceType resourceType, ICombinatorSettings settings) in c:\projects\OrchardEnlistments\1.x\src\Orchard.Web\Modules\Piedone.Combinator\Services\CombinatorService.cs:line 176
   at Piedone.Combinator.Services.CombinatorService.<>c__DisplayClass6.<>c__DisplayClass8.b__4(AcquireContext`1 ctx) in c:\projects\OrchardEnlistments\1.x\src\Orchard.Web\Modules\Piedone.Combinator\Services\CombinatorService.cs:line 83
   at Orchard.Caching.Cache`2.CreateEntry(TKey k, Func`2 acquire) in C:\projects\OrchardEnlistments\1.x\src\Orchard\Caching\Cache.cs:line 57
   at Orchard.Caching.Cache`2.<>c__DisplayClass2.b__0(TKey k) in C:\projects\OrchardEnlistments\1.x\src\Orchard\Caching\Cache.cs:line 19
   at System.Collections.Concurrent.ConcurrentDictionary`2.AddOrUpdate(TKey key, Func`2 addValueFactory, Func`3 updateValueFactory)
   at Orchard.Caching.Cache`2.Get(TKey key, Func`2 acquire) in C:\projects\OrchardEnlistments\1.x\src\Orchard\Caching\Cache.cs:line 17
   at Orchard.Caching.DefaultCacheManager.Get[TKey,TResult](TKey key, Func`2 acquire) in C:\projects\OrchardEnlistments\1.x\src\Orchard\Caching\DefaultCacheManager.cs:line 33
   at Piedone.Combinator.Services.CombinatorService.<>c__DisplayClass6.b__3(ResourceLocation location) in c:\projects\OrchardEnlistments\1.x\src\Orchard.Web\Modules\Piedone.Combinator\Services\CombinatorService.cs:line 73
   at Piedone.Combinator.Services.CombinatorService.CombineScripts(IList`1 resources, ICombinatorSettings settings) in c:\projects\OrchardEnlistments\1.x\src\Orchard.Web\Modules\Piedone.Combinator\Services\CombinatorService.cs:line 99
   at Piedone.Combinator.CombinedResourceManager.BuildRequiredResources(String stringResourceType) in c:\projects\OrchardEnlistments\1.x\src\Orchard.Web\Modules\Piedone.Combinator\CombinedResourceManager.cs:line 90

This is the first time I checked log, and it happens to also be right after I just rehydrated Orchard from a fresh db, fresh compile, empty App_Data dir, etc. My recipe includes Combinator, if that makes any difference. 

Is it possible to replace the code that's throwing this with a File.Exists check rather than letting it hit the exception, or something along those lines? 

Jan 11, 2012 at 8:55 AM
Edited Jan 11, 2012 at 8:55 AM

Hmm... The only way I can think of when that could happen if the DB cache and the file cache is in an inconsistent state, that means, the DB was wiped, but the file cache not or vica versa. This could happen if you either wipe the DB cache by hand, or the file cache; I think you've made the second: Combinator stores the files in the Media folder (well, it stores them with the IStorageProvider, but the default implementation happens to use the Media folder), so if you do a fresh install without emptying the cache first, but leave the Media/TenantName/Combinator folder intact, this error can happen. So either empty the cache first, or wipe the Combinator folder in Media too.

Actually there's no way to check file existence with IStorageProvider, but that shouldn't be an issue in that case.

Jan 11, 2012 at 2:03 PM

Thanks -- that fixed it. I rehydrated the site and this time also deleted /Orchard.Web/Media/Default folder as part of my step to wipe out the existing install. 

I also voted the issue tracker request you linked to. 

Jan 11, 2012 at 3:03 PM


I also implemented the methods in a fork for a few weeks, currently awaiting core developers' reply.