Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
danmoseley opened this issue Aug 10, 2021 · 5 comments · Fixed by #56915
Closed

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

danmoseley opened this issue Aug 10, 2021 · 5 comments · Fixed by #56915

Comments

@danmoseley
Copy link
Member

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 ------------
@dotnet-issue-labeler dotnet-issue-labeler bot added area-Extensions-FileSystem untriaged New issue has not been triaged by the area owner labels Aug 10, 2021
@ghost
Copy link

ghost commented Aug 10, 2021

Tagging subscribers to this area: @maryamariyan, @dotnet/area-extensions-filesystem
See info in area-owners.md if you want to be subscribed.

Issue Details

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 ------------
Author: danmoseley
Assignees: -
Labels:

untriaged, area-Extensions-FileSystem

Milestone: -

@danmoseley danmoseley removed the untriaged New issue has not been triaged by the area owner label Aug 10, 2021
@danmoseley
Copy link
Member Author

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

@adamsitnik adamsitnik added this to the 6.0.0 milestone Aug 10, 2021
@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label Aug 10, 2021
@ghost ghost removed the in-pr There is an active PR which will close this issue when it is merged label Aug 10, 2021
@danmoseley
Copy link
Member Author

danmoseley commented Aug 10, 2021

@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.

@jozkee
Copy link
Member

jozkee commented Aug 10, 2021

@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?

@jozkee jozkee reopened this Aug 10, 2021
@jozkee jozkee closed this as completed Aug 10, 2021
@ViktorHofer
Copy link
Member

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

@ghost ghost locked as resolved and limited conversation to collaborators Sep 10, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants