microsoft / microsoft/microsoft-performance-toolkit-sdk
When using the Engine, it's possible to enable a table that will not have its data available
@mslukebo is already working on this.
Since Mar 3, 2022.
- Dominant language
- C#
- Stars
- 239
- Forks
- 78
- Avg merge
- 4d 3h
- Merged PRs (30d)
- 2
Description
Describe the bug
When you use the Engine to process file(s) with multiple plugins concurrently loaded, it's possible to successfully enable a table that cannot be built due to its cookers never receiving data.
For example, consider the case where two plugins are loaded: PluginCSV and PluginTSV. PluginCSV and PluginTSV can process CSV and TSV files, respectively. Now, consider the data source set only contains a CSV file. PluginTSV will not create a CustomDataProcessor or SourceParser since it was not asked to process any files. This means source cookers hooked up to PluginTSV's SourceParser will never receive data, and tables that rely on any cookers connected to PluginTSV's parser will not be able to build.
In this situation, a call to Engine.EnableTable will succeed. This is unintuitive, since the successful call implies that the table can be built.
To Reproduce
Steps to reproduce the behavior:
- Create plugins that can process disjoint data sources
- Concurrently load these plugins into a
PluginSet - Create a
DataSourceSetfor thisPluginSetthat contains only data sources for a subset of the plugins - Create an
Enginewith thisDataSourceSet - Call
TryEnableTablefor any table/cooker associated with a plugin that does not have a datasource in theDataSourceSet.
Expected behavior
The TryEnableTable fails and returns false
Actual behavior
TheTryEnableTable succeeds and returns true.
Version information (please complete the following information):
- SDK version: 1.0.16
- Engine version (if applicable): 1.0.16
- WPA version (if applicable): N/A
Additional context
The following test, which can be added to ToolkitEngineTests, demonstrates the expected behavior and currently fails.
[TestMethod]
[IntegrationTest]
public void TryEnableTable_NoDataSources_Fails()
{
this.DefaultSet.AddDataSource(new FileDataSource("test" + Source123DataSource.Extension));
using var sut = Engine.Create(new EngineCreateInfo(this.DefaultSet.AsReadOnly()));
var cooker = Source4DataCooker.DataCookerPath;
Assert.IsFalse(sut.TryEnableTable(Source4DataCookerTable.TableDescriptor));
}
This is NOT an issue with TryEnableCooker. EnableCooker's documentation states:
/// <exception cref="NoDataSourceException">
/// There are inadequate data sources in <see cref="DataSourcesToProcess"/>
/// in order for the specified cooker to participate in processing.
/// </exception>
EnableTable, however, does not document throwing NoDataSourceException. Since we are able to throw this exception for cookers, we should be able to throw it for tables as well.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.