umbraco / Umbraco-CMS

Umbraco is a free and open source .NET content management system helping you deliver delightful digital experiences.
https://umbraco.com
MIT License
4.37k stars 2.64k forks source link

TempFileCleanup.CleanupFolder is failing if the target folder doesn't exist #8949

Closed clausjensen closed 3 years ago

clausjensen commented 3 years ago

Umbraco version

I am seeing this issue on Umbraco version: 8.6.4

Reproduction

Bug summary

When installing a new site with the starterkit (not sure if that is necessary but that's I was doing) the logs will have an error logged from TempFileCleanup.CleanupFolder() if it can't find the specified folder to clean up.

This should just be exiting silently if the folder doesn't exist (as it would then not need cleaning).

Logged error

{"@t":"2020-09-23T07:03:30.6996761Z","@mt":"{LogPrefix} Task has failed","@l":"Error","@x":"System.IO.DirectoryNotFoundException: Could not find a part of the path 'c:\\temp\\UmbracoCms.8.6.5-test1\\App_Data\\TEMP\\FileUploads'.\r\n   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)\r\n   at System.IO.FileSystemEnumerableIterator`1.CommonInit()\r\n   at System.IO.FileSystemEnumerableIterator`1..ctor(String path, String originalUserPath, String searchPattern, SearchOption searchOption, SearchResultHandler`1 resultHandler, Boolean checkHost)\r\n   at System.IO.DirectoryInfo.InternalGetFiles(String searchPattern, SearchOption searchOption)\r\n   at Umbraco.Web.Scheduling.TempFileCleanup.CleanupFolder(DirectoryInfo dir)\r\n   at Umbraco.Web.Scheduling.TempFileCleanup.PerformRun()\r\n   at Umbraco.Web.Scheduling.RecurringTaskBase.Run()\r\n   at Umbraco.Web.Scheduling.BackgroundTaskRunner`1.<RunAsync>d__40.MoveNext()","LogPrefix":"[LogScrubber] ","SourceContext":"Umbraco.Web.Scheduling.BackgroundTaskRunner","ProcessId":47268,"ProcessName":"iisexpress","ThreadId":50,"AppDomainId":7,"AppDomainAppId":"LMW3SVC15ROOT","MachineName":"CLAUSUMBRACO","Log4NetLevel":"ERROR"}

_This item has been added to our backlog AB#8427_

nul800sebastiaan commented 3 years ago

Was already fixed in https://github.com/umbraco/Umbraco-CMS/issues/7675