-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Unix file enumerator isn't thread safe #24295
Comments
It doesn't need to be; thread safety isn't a requirement of an enumerator. In fact, it's impossible to have an enumerator that can be correctly accessed by multiple threads concurrently, because there's no way for the implementation to make the separate MoveNext/Current calls atomic. If you access such enumerators from multiple threads, you're likely to get exceptions, including null refs. What we need to ensure is that you can't violate type safety or cause memory corruption with such access, and I see no evidence of that being a problem here. If there is such a problem, we need to fix it, though... do you see such a problem? |
Windows never fails. Weird results, but it never throws- shouldn't we meet the same bar here? @jkotas, any thoughts? |
That's not necessary. Tons of instance methods across the framework throw strange exceptions if the methods are used incorrectly. |
There is no problem to fix here. I have said a similar thing as Stephen in dotnet/corefx#25426 (comment) : Race condition in (safe) C# can manifest as odd managed exception, but it should not ever turn into (exploitable) buffer overrun. Clean System.NullReferenceException is not a memory corruption. |
So what should I check or allow? |
You should allow any clean exceptions to be thrown. But the test should not tear down the process (it is what happens in .NET Core unconditionally on memory corruptions that lead to AV). |
So you're suggesting I |
Making it more fine grained is fine too e.g. flagging specific exceptions that can be only triggered by handle recycling bug as failures is fine. |
Ok, thanks. |
@JeremyKuhne, the test is still disabled on Unix against this issue: runtime/src/libraries/System.IO.FileSystem/tests/Directory/EnumerableTests.cs Lines 14 to 16 in 04f2226
|
New test in dotnet/corefx#25426 uncovered this.
The text was updated successfully, but these errors were encountered: