-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Throttle async event queues #7784
Conversation
related issue - icsharpcode/RefactoringEssentials#159 |
if this is not sufficient, we can make it a bit better by holding onto only last event and cancel out middle ones for same key (document, analyzer) |
@dotnet-bot retest prtest/mac/dbg/unit32 please |
retest mac test since the failure was timeout on cloning repo. |
@@ -181,7 +181,7 @@ internal CompilationWithAnalyzers GetCompilationWithAnalyzers(Project project, C | |||
var data = await _executor.GetSyntaxAnalysisDataAsync(userDiagnosticDriver, stateSet, versions).ConfigureAwait(false); | |||
if (data.FromCache) | |||
{ | |||
RaiseDiagnosticsCreated(StateType.Syntax, document.Id, stateSet, new SolutionArgument(document), data.Items); | |||
RaiseDiagnosticCreatedFromCacheIfNeeded(StateType.Syntax, document, stateSet, data.Items); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Naming: RaiseDiagnostics instead of RaiseDiagnostic?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure
👍 |
Failure seems related:
|
it looks like race was always there, but surfaced due to this change where events are now throttled. currently testing fix for the race (basically explicitly check that events are fired) |
the race itself already existed but this PR made the race to surface.
@dotnet-bot retest prtest/win/dbg/eta please |
made eta to be retested. issues was immutable dll being locked by other process. |
Throttle async event queues
we had several reports saying we sometime OOM. investigation shows that we have a lot of async events pending especially around removing documents (ex, close solution, vs shutdown, solution re-analysis and etc).
pending events itself is not that much problem, but data captured for the events sometimes accumulated too much which can cause us to OOM.
this change puts a throttle to async events queue so that we block event producers if too many events are flooded to the queue. queue will be unblocked as pending events are processed by consumers.
...
I also changed some parts of engine not to raise unnecessary events.