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 hangs when file path is provided with wildcard without recurse flag #2800

Merged
merged 8 commits into from
Mar 15, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions ReleaseHistory.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# SARIF Package Release History (SDK, Driver, Converters, and Multitool)

## UNRELEASED
* BUG: Resolve process hangs when a file path is provided with a wildcard, but without a `-r` (recurse) flag during the multi-threaded analysis file enumeration phase.

## **v4.5.4 [Sdk](https://www.nuget.org/packages/Sarif.Sdk/v4.5.4) | [Driver](https://www.nuget.org/packages/Sarif.Driver/v4.5.4) | [Converters](https://www.nuget.org/packages/Sarif.Converters/v4.5.4) | [Multitool](https://www.nuget.org/packages/Sarif.Multitool/v4.5.4) | [Multitool Library](https://www.nuget.org/packages/Sarif.Multitool.Library/v4.5.4)
* BUG: Fix incorrect base class in rule ADO2012.

Expand Down
16 changes: 12 additions & 4 deletions src/Sarif.Driver/OrderedFileSpecifier.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,18 @@ private IEnumerable<IEnumeratedArtifact> EnumeratedArtifacts()
}
else
{
WriteFilesInDirectoryToChannel(directory, filesToProcessChannel, filter, new SortedSet<string>(StringComparer.Ordinal));

filesToProcessChannel.Writer.Complete();
directoryEnumerationTask = Task.CompletedTask;
directoryEnumerationTask = Task.Run(() =>
shaopeng-gh marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Member

@michaelcfanning michaelcfanning Mar 12, 2024

Choose a reason for hiding this comment

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

directoryEnumerationTask

where is the test for this? you haven't provided an explanation of what the problem was or explained the fix in any way.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

where is the test for this --- working on it next. Want to give an early update that the issue has been found, or else will need Scott's view since he made this change.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

added

{
try
{
WriteFilesInDirectoryToChannel(directory, filesToProcessChannel, filter, new SortedSet<string>(StringComparer.Ordinal));
}
finally
{
filesToProcessChannel.Writer.Complete();
directoryEnumerationTask = Task.CompletedTask;
shaopeng-gh marked this conversation as resolved.
Show resolved Hide resolved
}
});
}

ChannelReader<string> reader = filesToProcessChannel.Reader;
Expand Down
Loading