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

Crash from SendRequestAsync is unhandled #157

Closed
RyanSizemore opened this issue Jan 15, 2016 · 7 comments
Closed

Crash from SendRequestAsync is unhandled #157

RyanSizemore opened this issue Jan 15, 2016 · 7 comments

Comments

@RyanSizemore
Copy link

We are seeing a crash in our application with the following stack (we have seen ~3 occurrences of this):

System.AggregateException: A Task's exception(s) were not observed either by Waiting on the Task or accessing its Exception property. As a result, the unobserved exception was rethrown by the finalizer thread. 
---> System.Net.WebException: The request was aborted: The request was canceled.
   at Microsoft.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at Microsoft.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccess(Task task)
   at Microsoft.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
   at Microsoft.ApplicationInsights.Channel.Transmission.<SendRequestAsync>d__24.MoveNext()
   --- End of inner exception stack trace ---
---> (Inner Exception #0) System.Net.WebException: The request was aborted: The request was canceled.
   at Microsoft.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at Microsoft.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccess(Task task)
   at Microsoft.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
   at Microsoft.ApplicationInsights.Channel.Transmission.<SendRequestAsync>d__24.MoveNext()<---

Because the exception occurs in a task and is unhandled, we get a TaskUnobserved exception, resulting in our app crashing. It would seem that some level of try/catch is needed to suppress the exception (probably in the Transmission class), since we have no way to reliably suppress the failure at our app's level.

@SergeyKanzhelev
Copy link
Contributor

What version of SDK do you use? Is it server app or desktop/store?

@RyanSizemore
Copy link
Author

Not sure on the version. The assembly shows a version of 0.12.0.17386.

This is a desktop (C#) app.

  •   Ryan
    

From: Sergey Kanzhelev [mailto:notifications@github.com]
Sent: Friday, January 15, 2016 12:37 PM
To: Microsoft/ApplicationInsights-dotnet ApplicationInsights-dotnet@noreply.github.com
Cc: Ryan Sizemore ryansize@microsoft.com
Subject: Re: [ApplicationInsights-dotnet] Crash from SendRequestAsync is unhandled (#157)

What version of SDK do you use? Is it server app or desktop/store?


Reply to this email directly or view it on GitHubhttps://github.com//issues/157#issuecomment-172086392.

@SergeyKanzhelev
Copy link
Contributor

@izikl , I believe it was fixed, right? Do you remember exact version?

@izikl
Copy link
Contributor

izikl commented Jan 16, 2016

Not sure. @RyanSizemore can you upgrade to a stable released SDK?

@abaranch
Copy link
Contributor

@RyanSizemore. Closing the issue, please upgrade at least to the latest stable version. 0.12 is not supported any more.

@mifurm
Copy link

mifurm commented Jul 26, 2017

Team, I have AppInsight SDK installed with versions, which you can see below the picture. This is ASP.Net MVC app and the issue described in here still exsists.
Here you have the error.
appinsight

And here are my SDK versions. Can you please help?








<package id="Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel" version="2.1.0" targetFramework

@SergeyKanzhelev
Copy link
Contributor

@mifurm Application Insights SDK has logic to collect unobserved exceptions. It may indicate a problem with your application. Typically it will happen when Task was started and not awaited for by any code. And this task throws an exception. So there is no code to handle this exception. It may indicate a bigger problem with your code.

It's not easy to correlate an unobserver exception with the code that initiated it. Upgrade to 2.4 SDK may help as that version has improved telemetry correlation capabilities.

TimothyMothra pushed a commit that referenced this issue Oct 25, 2019
Adding server telemetry channel, adaptive sampling and making Active as default configuraiton.
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

5 participants