This repository was archived by the owner on Jul 5, 2020. It is now read-only.
Fix race condition in generic diagnostic listener#948
Merged
Conversation
Author
|
Please ignore build failure, it was cancelled, re-started and passed, but github did not pick up successful run |
| this.Client = new TelemetryClient(configuration); | ||
| } | ||
|
|
||
| public void Subscribe() |
There was a problem hiding this comment.
for this public method, can you please add a
cijothomas
approved these changes
Jul 9, 2018
| private IDisposable listenerSubscription; | ||
| private List<IDisposable> individualSubscriptions; | ||
|
|
||
| protected DiagnosticSourceListenerBase(TelemetryConfiguration configuration) |
There was a problem hiding this comment.
Because the Subscribe method is required, should we make a reference to it in the constructor?
I don't know how often a developer creates a new DiagnosticSourceListener (probably not often :) ), but I wonder that they may not know to look for the Subscribe method.
Author
There was a problem hiding this comment.
this is an internal class, it's only us who call this method and just once. I can add the comment, though
TimothyMothra
approved these changes
Jul 10, 2018
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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
When generic diagnostic listener subscribes to DiagnosticSource, it attempts to use this in its own constructor, while some properties (filters) are not initialized yet.
As a result, if DiagnosticSource is created BEFORE the generic listener, it's guaranteed to miss subscription event and never receive anything.
This PR fixes this issue.
For significant contributions please make sure you have completed the following items:
Changes in public surface reviewed
Design discussion issue #
CHANGELOG.md updated with one line description of the fix, and a link to the original issue.
The PR will trigger build, unit tests, and functional tests automatically. If your PR was submitted from fork - mention one of committers to initiate the build for you.
If you want to to re-run the build/tests, the easiest way is to simply Close and Re-Open this same PR. (Just click 'close pull request' followed by 'open pull request' buttons at the bottom of the PR)
Please follow [these] (https://github.com/Microsoft/ApplicationInsights-dotnet-server/blob/develop/CONTRIBUTING.md) instructions to build and test locally.