Skip to content

Microsoft.Extensions.FileProviders.Physical.Tests terminated #57128

Closed

Description

@danmoseley

Product bug here. FileNotFoundException should not take down the app.

'Microsoft.Extensions.FileProviders.Physical.Tests' from job 7359fb7e-bed2-4677-8025-0794e6d50356 workitem 38c6c2ba-c9ab-42a5-998b-a79c5089ce69 (windows.10.amd64.server19h1.open.rt) executed on machine a0036MX

net6.0-windows-Debug-x86-CoreCLR_release-Windows.10.Amd64.Server19H1.Open


Starting:    Microsoft.Extensions.FileProviders.Physical.Tests (parallel test collections = on, max threads = 2)
Unhandled exception. System.IO.FileNotFoundException: Could not find file 'C:\h\w\A9AD08CB\t\ev1xwosb.xvy\igyuv4fj.oko'.
File name: 'C:\h\w\A9AD08CB\t\ev1xwosb.xvy\igyuv4fj.oko'
   at System.IO.FileSystem.GetFindData(String fullPath, Boolean isDirectory, Boolean ignoreAccessDenied, WIN32_FIND_DATA& findData) in /_/src/libraries/System.Private.CoreLib/src/System/IO/FileSystem.Windows.cs:line 219
   at System.IO.FileSystem.GetFinalLinkTarget(String linkPath, Boolean isDirectory) in /_/src/libraries/System.Private.CoreLib/src/System/IO/FileSystem.Windows.cs:line 538
   at System.IO.FileSystem.ResolveLinkTarget(String linkPath, Boolean returnFinalTarget, Boolean isDirectory) in /_/src/libraries/System.Private.CoreLib/src/System/IO/FileSystem.Windows.cs:line 433
   at System.IO.FileSystemInfo.ResolveLinkTarget(Boolean returnFinalTarget) in /_/src/libraries/System.Private.CoreLib/src/System/IO/FileSystemInfo.cs:line 170
   at Microsoft.Extensions.FileProviders.Physical.FileSystemInfoHelper.GetFileLinkTargetLastWriteTimeUtc(FileInfo fileInfo) in /_/src/libraries/Microsoft.Extensions.FileProviders.Physical/src/Internal/FileSystemInfoHelper.cs:line 54
   at Microsoft.Extensions.FileProviders.Physical.PollingFileChangeToken.GetLastWriteTimeUtc() in /_/src/libraries/Microsoft.Extensions.FileProviders.Physical/src/PollingFileChangeToken.cs:line 57
   at Microsoft.Extensions.FileProviders.Physical.PollingFileChangeToken.get_HasChanged() in /_/src/libraries/Microsoft.Extensions.FileProviders.Physical/src/PollingFileChangeToken.cs:line 101
   at Microsoft.Extensions.FileProviders.Physical.PhysicalFilesWatcher.RaiseChangeEvents(Object state) in /_/src/libraries/Microsoft.Extensions.FileProviders.Physical/src/PhysicalFilesWatcher.cs:line 455
   at System.Threading.TimerQueueTimer.CallCallback(Boolean isThreadPool) in /_/src/libraries/System.Private.CoreLib/src/System/Threading/Timer.cs:line 712
   at System.Threading.TimerQueueTimer.Fire(Boolean isThreadPool) in /_/src/libraries/System.Private.CoreLib/src/System/Threading/Timer.cs:line 673
   at System.Threading.TimerQueue.FireNextTimers() in /_/src/libraries/System.Private.CoreLib/src/System/Threading/Timer.cs:line 326
   at System.Threading.TimerQueue.AppDomainTimerCallback(Int32 id) in /_/src/coreclr/System.Private.CoreLib/src/System/Threading/Timer.CoreCLR.cs:line 59
----- end Tue 08/10/2021  5:45:17.51 ----- exit code -532462766 ------------

Activity

  1. ghost added
    untriaged
    on Aug 10, 2021
  2. removed
    untriaged
    on Aug 10, 2021
  3. danmoseley commented on Aug 10, 2021

    @danmoseley
    ContributorAuthor

    This is the new symlink API, but seems a reasonable exception to throw, so we should handle it.

  4. added this to the 6.0.0 milestone on Aug 10, 2021
  5. ghost added
    in-pr
    on Aug 10, 2021
  6. ghost removed
    in-pr
    on Aug 10, 2021
  7. danmoseley commented on Aug 10, 2021

    @danmoseley
    ContributorAuthor

    @adamsitnik is it fragile to run this code on a timer (basically QUWI) and aim to catch only documented exceptions? Since if something wierd happens the app terminates. I wonder whether it should capture all exceptions, like a Task, and rethrow them on the requesting thread? Not sure what the usual pattern is in this code, or whether rethrowing on the original thread would terminate the app anyway.

  8. jozkee commented on Aug 10, 2021

    @jozkee
    Member

    @danmoseley FWIW I think this happens because Timer.Dispose() doesn't prevent queued timer callbacks from being called after disposed.

    Callbacks can occur after the Dispose() method overload has been called, because the timer queues callbacks for execution by thread pool threads. You can use the Dispose(WaitHandle) method overload to wait until all callbacks have completed.

    We could switch to Timer.Dispose(WaitHandle) in order to wait for all queued callbacks to finish before continuing disposing and that could prevent the FileNotFoundException, however, PhysicalFileProvider code was already kinda resilient to these errors when used with non-link files so maybe we should go for resiliency instead?

  9. reopened this on Aug 10, 2021
  10. ViktorHofer commented on Aug 11, 2021

    @ViktorHofer
    Member

    FYI in case this is has the same underlying cause: #57221.

  11. ghost locked as resolved and limited conversation to collaborators on Sep 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions