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

SpecFlow Visual Studio integration hanging Visual Studio waiting on telemetry to be flushed to the network #195

Open
davkean opened this issue Nov 1, 2021 · 2 comments

Comments

@davkean
Copy link

davkean commented Nov 1, 2021

SpecFlow Version

Unknown

Test Runner Version Number

Unknown

Issue Description

I'm from the Visual Studio performance team and our telemetry is showing that that SpecFlow VS integration is hanging Visual Studio while it sends and flushes telemetry. This is preventing users from interacting with VS while this code is running.

Over the past 21 days, it has had the following impact on Visual Studio:

Root Leaf Expressed Hits Total Hits Duration (75th Percentile) Delayed Mouse Clicks Delayed Key Strokes
techtalk.specflow.visualstudiointegration.dll!TechTalk.SpecFlow.VsIntegration.SpecFlowPackagePackage.InitializeAsync microsoft.applicationinsights.dll!Microsoft.ApplicationInsights.Channel.InMemoryTransmitter.DequeueAndSend 2739 4717 4.8 sec 2710 32

Expressed delays are situations where the UI hung while within this method and it interrupted/prevented users mouse or keyboard input. Total hits are all the times the UI hung while within this method, regardless of whether input was interrupted.

There are many call stacks that trigger this failure however, they all contain the the following frames:

chtalk.specflow.visualstudiointegration.dll!TechTalk.SpecFlow.VsIntegration.SpecFlowPackagePackage.InitializeAsync
-> mscorlib!System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start
--> techtalk.specflow.visualstudiointegration.dll!TechTalk.SpecFlow.VsIntegration.SpecFlowPackagePackage+<InitializeAsync>d__.MoveNext
---> techtalk.specflow.ideintegration.dll!TechTalk.SpecFlow.IdeIntegration.Install.InstallServices.OnPackageLoad
----> techtalk.specflow.vsintegration.implementation.dll!TechTalk.SpecFlow.VsIntegration.Implementation.Analytics.AnalyticsTransmitter.TransmitExtensionLoadedEvent
-----> techtalk.specflow.vsintegration.implementation.dll!TechTalk.SpecFlow.VsIntegration.Implementation.Analytics.AnalyticsTransmitter.Execute
------> techtalk.specflow.vsintegration.implementation.dll!TechTalk.SpecFlow.VsIntegration.Implementation.Analytics.AppInsightsAnalyticsTransmitterSink.TransmitEvent
-------> microsoft.applicationinsights.dll!Microsoft.ApplicationInsights.Channel.InMemoryChannel.Flush
--------> microsoft.applicationinsights.dll!Microsoft.ApplicationInsights.Channel.InMemoryTransmitter.Flush
---------> microsoft.applicationinsights.dll!Microsoft.ApplicationInsights.Channel.InMemoryTransmitter.DequeueAndSend

To fix this issue, please avoid Flushing the AppInsights channel on the UI thread and/or blocking on it, for example:

Task.Run(() => channel.Flush()).Forget();

Steps to Reproduce

This data comes our telemetry system, so we do not have any information on the versions of SpecFlow or any dlls involved in this problem. We also have no understanding of the steps involved to reproduce the above situation other than the fact this data was just captured from real world usage.

Link to Repro Project

No response

@SabotageAndi
Copy link
Contributor

Thanks for the issue report. We will have a look at it. With the stack trace it should be not that hard to find the issue.

@SabotageAndi SabotageAndi transferred this issue from SpecFlowOSS/SpecFlow Nov 3, 2021
@davkean
Copy link
Author

davkean commented Nov 4, 2021

@SabotageAndi We found a bunch more stacks and they all in AppInsightsAnalyticsTransmitterSink.TransmitEvent, so be sure to find all direct and indirect callers of it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants