-
Notifications
You must be signed in to change notification settings - Fork 830
fix for race condition in FileIndex.fileIndexOfFile #18008
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
Merged
Merged
Changes from 13 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
75c59fa
fix for race condition in FileIndex.fileIndexOfFile
Martin521 d838f1b
fantomas
Martin521 7326da9
fixed ilverify baselines (just a single line number changed)
Martin521 e552abd
Merge remote-tracking branch 'upstream/main' into fileindex-race
Martin521 09363e0
add release notes entry
Martin521 4bce3d3
Merge remote-tracking branch 'upstream/main' into fileindex-race
Martin521 9bda5aa
Merge remote-tracking branch 'upstream/main' into fileindex-race
Martin521 d5f1ab0
Merge remote-tracking branch 'upstream/main' into fileindex-race
Martin521 63ee595
Merge remote-tracking branch 'upstream/main' into fileindex-race
Martin521 aeb0921
Merge remote-tracking branch 'upstream/main' into fileindex-race
Martin521 e462cb7
Merge remote-tracking branch 'upstream/main' into fileindex-race
Martin521 fe1533a
Merge remote-tracking branch 'upstream/main' into fileindex-race
Martin521 9ad499f
Merge remote-tracking branch 'upstream/main' into fileindex-race
Martin521 51eb10a
Merge remote-tracking branch 'upstream/main' into fileindex-race
Martin521 1e554d6
FileToIndex: Added unlocked read so that lock is entered for new file…
Martin521 f1abc28
update ilverify baselines (changed line numbers only)
Martin521 d4a64bd
Merge branch 'main' into fileindex-race
psfinaki 932ad12
Fix ILVerify
vzarytovskii 1b2b8b2
Merge remote-tracking branch 'upstream/main' into fileindex-race
Martin521 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
tests/FSharp.Compiler.ComponentTests/Miscellaneous/FileIndex.fs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| module Miscellaneous.FileIndex | ||
|
|
||
| open FSharp.Compiler.Text | ||
| open System.Threading.Tasks | ||
| open Xunit | ||
|
|
||
| // This is a regression test for a bug that existed in FileIndex.fileIndexOfFile | ||
| [<Fact>] | ||
| let NoRaceCondition() = | ||
| let parallelOptions = ParallelOptions() | ||
| let mutable count = 10000 | ||
| while count > 0 do | ||
| let file = $"test{count}.fs" | ||
| let files = Array.create 2 file | ||
| let indices = Array.create 2 -1 | ||
| let getFileIndex i = indices[i] <- FileIndex.fileIndexOfFile files[i] | ||
| Parallel.For(0, files.Length, parallelOptions, getFileIndex) |> ignore | ||
| if indices[0] <> indices[1] then | ||
| Assert.Fail $"Found different indices: {indices[0]} and {indices[1]}" | ||
| count <- count - 1 | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.