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

Unhandled exceptions in V2FeedParser #7523

Open
onovotny opened this Issue Nov 19, 2018 · 8 comments

Comments

Projects
None yet
3 participants
@onovotny
Copy link

onovotny commented Nov 19, 2018

I'm seeing several unhandled exceptions in NuGet Package Explorer that come from NuGet code.

Stack traces posted.

System.NullReferenceException: Object reference not set to an instance of an object.
   at NuGet.Protocol.PackageSearchMetadataV2Feed.GetVersionsAsync()
   at PackageExplorerViewModel.PackageInfoViewModel+<LoadPackages>d__57.MoveNext() in D:\a\1\s\PackageViewModel\PackageChooser\PackageInfoViewModel.cs:line 191
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. ---> NuGet.Protocol.Core.Types.FatalProtocolException: Failed to fetch results from V2 feed at 'http://<redacted>:8081/repository/teamcity/FindPackagesById()?id='<redacted>'&semVerLevel=2.0.0' with following message : A task was canceled. ---> System.Threading.Tasks.TaskCanceledException: A task was canceled.
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter<TResult>.GetResult()
   at NuGet.Protocol.ServerWarningLogHandler+<SendAsync>d__1.MoveNext()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter<TResult>.GetResult()
   at NuGet.Protocol.StsAuthenticationHandler+<SendAsync>d__9.MoveNext()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter<TResult>.GetResult()
   at NuGet.Protocol.HttpSourceAuthenticationHandler+<SendAsync>d__9.MoveNext()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable<TResult>+ConfiguredTaskAwaiter.GetResult()
   at System.Net.Http.HttpClient+<FinishSendAsyncUnbuffered>d__59.MoveNext()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable<TResult>+ConfiguredTaskAwaiter.GetResult()
   at NuGet.Protocol.TimeoutUtility+<StartWithTimeout>d__0<T>.MoveNext()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter<TResult>.GetResult()
   at NuGet.Protocol.HttpRetryHandler+<SendAsync>d__0.MoveNext()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter<TResult>.GetResult()
   at NuGet.Protocol.HttpSource+<GetThrottledResponse>d__20.MoveNext()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter<TResult>.GetResult()
   at NuGet.Protocol.HttpSource+<>c__DisplayClass14_0<T>+<<GetAsync>b__0>d.MoveNext()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter<TResult>.GetResult()
   at NuGet.Common.ConcurrencyUtilities+<ExecuteWithFileLockedAsync>d__2<T>.MoveNext()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter<TResult>.GetResult()
   at NuGet.Protocol.HttpSource+<GetAsync>d__14<T>.MoveNext()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter<TResult>.GetResult()
   at NuGet.Protocol.V2FeedParser+<LoadXmlAsync>d__51.MoveNext()
   --- End of inner exception stack trace ---
   at NuGet.Protocol.V2FeedParser+<LoadXmlAsync>d__51.MoveNext()
   --- End of inner exception stack trace ---
   at Bugsnag.UnhandledException.HandleEvent(Exception exception, bool runtimeEnding)
   at Bugsnag.UnhandledException.TaskScheduler_UnobservedTaskException(object sender, UnobservedTaskExceptionEventArgs e)
   at System.Threading.Tasks.TaskScheduler.PublishUnobservedTaskException(object sender, UnobservedTaskExceptionEventArgs ueea)
   at System.Threading.Tasks.TaskExceptionHolder.Finalize()
NuGet.Protocol.Core.Types.FatalProtocolException: Failed to fetch results from V2 feed at 'http://<redacted>:8080/nuget/FindPackagesById()?id='<redacted>'&semVerLevel=2.0.0' with following message : A task was canceled. ---> System.Threading.Tasks.TaskCanceledException: A task was canceled.
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at NuGet.Protocol.ServerWarningLogHandler+<SendAsync>d__1.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at NuGet.Protocol.StsAuthenticationHandler+<SendAsync>d__9.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at NuGet.Protocol.HttpSourceAuthenticationHandler+<SendAsync>d__9.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Net.Http.HttpClient+<FinishSendAsyncUnbuffered>d__59.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at NuGet.Protocol.TimeoutUtility+<StartWithTimeout>d__0<T>.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at NuGet.Protocol.HttpRetryHandler+<SendAsync>d__0.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at NuGet.Protocol.HttpSource+<GetThrottledResponse>d__20.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at NuGet.Protocol.HttpSource+<>c__DisplayClass14_0<T>+<<GetAsync>b__0>d.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at NuGet.Common.ConcurrencyUtilities+<ExecuteWithFileLockedAsync>d__2<T>.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at NuGet.Protocol.HttpSource+<GetAsync>d__14<T>.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at NuGet.Protocol.V2FeedParser+<LoadXmlAsync>d__51.MoveNext()
   --- End of inner exception stack trace ---
   at NuGet.Protocol.V2FeedParser+<LoadXmlAsync>d__51.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at NuGet.Protocol.V2FeedParser+<QueryV2FeedAsync>d__49.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at NuGet.Protocol.V2FeedParser+<FindPackagesByIdAsync>d__38.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at NuGet.Protocol.PackageMetadataResourceV2Feed+<GetMetadataAsync>d__4.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter<TResult>.GetResult()
   at PackageExplorerViewModel.PackageInfoViewModel+<LoadPackages>d__57.MoveNext()
@onovotny

This comment has been minimized.

Copy link
Author

onovotny commented Nov 19, 2018

If the task is canceled, nothing handles the task result by awaiting it:
https://github.com/NuGet/NuGet.Client/blob/5d1af18e560b5f381626b5a7e9ce2acacb6211db/src/NuGet.Core/NuGet.Protocol/LegacyFeed/V2FeedParser.cs#L451

Could be something else in there too.

@nkolev92

This comment has been minimized.

Copy link
Member

nkolev92 commented Nov 19, 2018

The first stack trace looks like it's always been a problem.

https://github.com/NuGet/NuGet.Client/blob/5f05060cbcc7e2e1ddd36cf9e7fcab186a424087/src/NuGet.Core/NuGet.Protocol/Model/PackageSearchMetadataV2Feed.cs#L127
The OnDemandParsedVersions will always be null.

@onovotny

This comment has been minimized.

Copy link
Author

onovotny commented Nov 21, 2018

For triage purposes, this is an unhandled exception which will crash the host process. Please fix ASAP....

@rrelyea

This comment has been minimized.

Copy link
Contributor

rrelyea commented Nov 29, 2018

@onovotny - can you help with more data to help us triage. Is this a regression? what version did you hit this on? possible workarounds? impact?

@onovotny

This comment has been minimized.

Copy link
Author

onovotny commented Nov 29, 2018

I don't have VS crash data, but I see many crashes due to it in my telemetry for NuGet Package Explorer. It's in at least 4.8+, I don't know how long its been there. I only started collecting telemetry data earlier this month.

There are no possible workarounds because it's unhandled.

   at System.Threading.Tasks.TaskScheduler.PublishUnobservedTaskException(object sender, UnobservedTaskExceptionEventArgs ueea)
   at System.Threading.Tasks.TaskExceptionHolder.Finalize()

campersau added a commit to campersau/NuGet.Client that referenced this issue Dec 15, 2018

campersau added a commit to campersau/NuGet.Client that referenced this issue Jan 25, 2019

nkolev92 added a commit to NuGet/NuGet.Client that referenced this issue Feb 11, 2019

@nkolev92

This comment has been minimized.

Copy link
Member

nkolev92 commented Feb 11, 2019

The first PR shouldn't have closed this.

@onovotny

This comment has been minimized.

Copy link
Author

onovotny commented Feb 11, 2019

Looks like this should stay open until NuGet/NuGet.Client#2569 is merged?

@nkolev92 nkolev92 reopened this Feb 12, 2019

@nkolev92

This comment has been minimized.

Copy link
Member

nkolev92 commented Feb 12, 2019

When I commented I meant to click reopen, but for some reason didn't.
Thanks for following up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment