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

Fix ObjectDisposedException in FileSystemWatcher.OSX.cs #34589

Merged
merged 1 commit into from
Apr 7, 2020

Conversation

stephentoub
Copy link
Member

Synchronize access to disposing the SafeHandle, and clean up some code distributed oddly between the ctor and Start, so as to make more fields readonly and only register for cancellation once everything has started, to avoid race conditions that could otherwise result between cancellation and starting happening concurrently.

Fixes #30056 (comment)
cc: @wfurt

(Separately, I don't see what's a) keeping the callback delegate alive if the FSW is dropped, and b) what's allowing state to be unregistered/cleaned up if the FSW is dropped. Worth following up on unless I'm just missing it.)

Synchronize access to disposing the SafeHandle, and clean up some code distributed oddly between the ctor and Start, so as to make more fields readonly and only register for cancellation once everything has started, to avoid race conditions that could otherwise result between cancellation and starting happening concurrently.
Copy link
Member

@wfurt wfurt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@stephentoub
Copy link
Member Author

/azp list

@stephentoub
Copy link
Member Author

/azp run runtime-libraries outerloop-osx

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@stephentoub stephentoub merged commit 8aa97da into dotnet:master Apr 7, 2020
@stephentoub stephentoub deleted the fswfix branch April 7, 2020 14:49
@ghost ghost locked as resolved and limited conversation to collaborators Dec 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SafeHandle use-after-dispose in FileSystemWatcher on OSX
3 participants