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 deadlock in TestEventListener and re-enable ArrayPool DiagnosticEvent tests #45469

Merged
merged 4 commits into from
Dec 2, 2020
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public void AddSource(Guid guid, EventLevel level, EventKeywords keywords = Even

private void AddSource(string name, Guid? guid, EventLevel level, EventKeywords keywords)
{
EventSource sourceToEnable = null;
lock (_eventSourceList)
{
var settings = new Settings()
Expand All @@ -61,26 +62,34 @@ private void AddSource(string name, Guid? guid, EventLevel level, EventKeywords
{
if (name == source.Name || guid == source.Guid)
{
EnableEventSource(source, level, keywords);
sourceToEnable = source;
break;
}
}
}

if (sourceToEnable != null)
stephentoub marked this conversation as resolved.
Show resolved Hide resolved
{
EnableEventSource(sourceToEnable, level, keywords);
}
}

public void AddActivityTracking() =>
AddSource("System.Threading.Tasks.TplEventSource", EventLevel.Informational, (EventKeywords)0x80 /* TasksFlowActivityIds */);

protected override void OnEventSourceCreated(EventSource eventSource)
{
bool shouldEnable = false;
Settings settings;
lock (_eventSourceList)
{
_eventSourceList.Add(eventSource);
shouldEnable = _names.TryGetValue(eventSource.Name, out settings) || _guids.TryGetValue(eventSource.Guid, out settings);
}

if (_names.TryGetValue(eventSource.Name, out Settings settings) ||
_guids.TryGetValue(eventSource.Guid, out settings))
{
EnableEventSource(eventSource, settings.Level, settings.Keywords);
}
if (shouldEnable)
stephentoub marked this conversation as resolved.
Show resolved Hide resolved
{
EnableEventSource(eventSource, settings.Level, settings.Keywords);
}
}

Expand Down
2 changes: 0 additions & 2 deletions src/libraries/System.Buffers/tests/ArrayPool/UnitTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,6 @@ public static void RentingAfterPoolExhaustionReturnsSizeForCorrespondingBucket_A
Assert.Equal(64, pool.Rent(63).Length); // still get original size
}

[ActiveIssue("https://github.com/dotnet/runtime/issues/42899")]
[ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
public static void RentBufferFiresRentedDiagnosticEvent()
{
Expand All @@ -419,7 +418,6 @@ public static void RentBufferFiresRentedDiagnosticEvent()
});
}

[ActiveIssue("https://github.com/dotnet/runtime/issues/42899")]
[ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
public static void ReturnBufferFiresDiagnosticEvent()
{
Expand Down