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

Visual Studio hung with Akavache running on Main thread #1662

Closed
jcansdale opened this Issue May 15, 2018 · 0 comments

Comments

Projects
None yet
2 participants
@jcansdale
Contributor

jcansdale commented May 15, 2018

  • GitHub Extension for Visual Studio version: 2.5.1
  • Visual Studio version: 2017
  1. Open VS 2017 with GitHub pane open (debugger attached)
  2. Open PullRequestSandbox repo
  3. There a ding sound.
  4. Visual Studio freezes with spinning wheel
  5. Debugger Break All shows the following:

image

image

Here is the stack trace:

 	WindowsBase.dll!System.Windows.Threading.DispatcherSynchronizationContext.Wait(System.IntPtr[] waitHandles, bool waitAll, int millisecondsTimeout)	Unknown	Symbols loaded.
 	mscorlib.dll!System.Threading.SynchronizationContext.InvokeWaitMethodHelper(System.Threading.SynchronizationContext syncContext, System.IntPtr[] waitHandles, bool waitAll, int millisecondsTimeout)	Unknown	No symbols loaded.
 	[Native to Managed Transition]		Annotated Frame
 	[Managed to Native Transition]		Annotated Frame
 	mscorlib.dll!System.Threading.Monitor.Wait(object obj, int millisecondsTimeout, bool exitContext)	Unknown	No symbols loaded.
 	mscorlib.dll!System.Threading.Monitor.Wait(object obj, int millisecondsTimeout)	Unknown	No symbols loaded.
 	mscorlib.dll!System.Threading.ManualResetEventSlim.Wait(int millisecondsTimeout = 500, System.Threading.CancellationToken cancellationToken)	Unknown	No symbols loaded.
>	Akavache.Sqlite3.dll!Akavache.Sqlite3.Internal.BlockingCollection<Akavache.Sqlite3.OperationQueueItem>.TryTake(out Akavache.Sqlite3.OperationQueueItem item = null, int milliseconds = -1, System.Threading.CancellationToken cancellationToken, bool throwComplete = true) Line 242	C#	Symbols loaded.
 	Akavache.Sqlite3.dll!Akavache.Sqlite3.SqliteOperationQueue.Start.AnonymousMethod__18_0() Line 133	C#	Symbols loaded.
 	mscorlib.dll!System.Threading.Tasks.Task.InnerInvoke()	Unknown	No symbols loaded.
 	mscorlib.dll!System.Threading.Tasks.Task.Execute()	Unknown	No symbols loaded.
 	mscorlib.dll!System.Threading.Tasks.Task.ExecutionContextCallback(object obj)	Unknown	No symbols loaded.
 	mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)	Unknown	No symbols loaded.
 	mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)	Unknown	No symbols loaded.
 	mscorlib.dll!System.Threading.Tasks.Task.ExecuteWithThreadLocal(ref System.Threading.Tasks.Task currentTaskSlot = Id = 12572, Status = Running, Method = Inspecting the state of an object in the debuggee of type System.Delegate is not supported in this context.)	Unknown	No symbols loaded.
 	mscorlib.dll!System.Threading.Tasks.Task.ExecuteEntry(bool bPreventDoubleExecution)	Unknown	No symbols loaded.
 	mscorlib.dll!System.Threading.Tasks.TaskScheduler.TryExecuteTask(System.Threading.Tasks.Task task)	Unknown	No symbols loaded.
 	Microsoft.VisualStudio.Shell.UI.Internal.dll!Microsoft.VisualStudio.Services.TaskSchedulerService.VsUIThreadBlockableTaskScheduler.DoOneTask(out int dequeuedTaskCount = 1)	Unknown	Symbols loaded.
 	Microsoft.VisualStudio.Shell.UI.Internal.dll!Microsoft.VisualStudio.Services.TaskSchedulerService.VsUINormalPriorityScheduler.OnTaskQueued.AnonymousMethod__2_0()	Unknown	Symbols loaded.
 	WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate callback, object args, int numArgs)	Unknown	Symbols loaded.
 	WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.TryCatchWhen(object source = {System.Windows.Threading.Dispatcher}, System.Delegate callback, object args, int numArgs, System.Delegate catchHandler = null)	Unknown	Symbols loaded.
 	WindowsBase.dll!System.Windows.Threading.DispatcherOperation.InvokeImpl()	Unknown	Symbols loaded.
 	WindowsBase.dll!System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(object state)	Unknown	Symbols loaded.
 	WindowsBase.dll!MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(object obj)	Unknown	Symbols loaded.
 	mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)	Unknown	No symbols loaded.
 	mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)	Unknown	No symbols loaded.
 	mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state)	Unknown	No symbols loaded.
 	WindowsBase.dll!MS.Internal.CulturePreservingExecutionContext.Run(MS.Internal.CulturePreservingExecutionContext executionContext = {MS.Internal.CulturePreservingExecutionContext}, System.Threading.ContextCallback callback, object state)	Unknown	Symbols loaded.
 	WindowsBase.dll!System.Windows.Threading.DispatcherOperation.Invoke()	Unknown	Symbols loaded.
 	WindowsBase.dll!System.Windows.Threading.Dispatcher.ProcessQueue()	Unknown	Symbols loaded.
 	WindowsBase.dll!System.Windows.Threading.Dispatcher.WndProcHook(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam, ref bool handled)	Unknown	Symbols loaded.
 	WindowsBase.dll!MS.Win32.HwndWrapper.WndProc(System.IntPtr hwnd = 0x00250d50, int msg = 49626, System.IntPtr wParam = 0x00000000, System.IntPtr lParam = 0x00000000, ref bool handled = false)	Unknown	Symbols loaded.
 	WindowsBase.dll!MS.Win32.HwndSubclass.DispatcherCallbackOperation(object o)	Unknown	Symbols loaded.
 	WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate callback, object args, int numArgs)	Unknown	Symbols loaded.
 	WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.TryCatchWhen(object source = {System.Windows.Threading.Dispatcher}, System.Delegate callback, object args, int numArgs, System.Delegate catchHandler = null)	Unknown	Symbols loaded.
 	WindowsBase.dll!System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority priority, System.TimeSpan timeout, System.Delegate method, object args, int numArgs)	Unknown	Symbols loaded.
 	WindowsBase.dll!MS.Win32.HwndSubclass.SubclassWndProc(System.IntPtr hwnd = 0x00250d50, int msg = 49626, System.IntPtr wParam = 0x00000000, System.IntPtr lParam = 0x00000000)	Unknown	Symbols loaded.
 	[Native to Managed Transition]		Annotated Frame
 	[Managed to Native Transition]		Annotated Frame
 	Microsoft.VisualStudio.Shell.UI.Internal.dll!Microsoft.VisualStudio.Services.VsTask.GetCallbackForMultipleParent.AnonymousMethod__0(System.Threading.Tasks.Task<object>[] _)	Unknown	Symbols loaded.
 	Microsoft.VisualStudio.Shell.UI.Internal.dll!Microsoft.VisualStudio.Services.VsTask.GetCallbackForSingleParent.AnonymousMethod__0(System.Threading.Tasks.Task<object> internalTask)	Unknown	Symbols loaded.
 	mscorlib.dll!System.Threading.Tasks.ContinuationResultTaskFromResultTask<object, object>.InnerInvoke()	Unknown	No symbols loaded.
 	mscorlib.dll!System.Threading.Tasks.Task.Execute()	Unknown	No symbols loaded.
 	mscorlib.dll!System.Threading.Tasks.Task.ExecutionContextCallback(object obj)	Unknown	No symbols loaded.
 	mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)	Unknown	No symbols loaded.
 	mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)	Unknown	No symbols loaded.
 	mscorlib.dll!System.Threading.Tasks.Task.ExecuteWithThreadLocal(ref System.Threading.Tasks.Task currentTaskSlot = Id = 12572, Status = Running, Method = Inspecting the state of an object in the debuggee of type System.Delegate is not supported in this context.)	Unknown	No symbols loaded.
 	mscorlib.dll!System.Threading.Tasks.Task.ExecuteEntry(bool bPreventDoubleExecution)	Unknown	No symbols loaded.
 	mscorlib.dll!System.Threading.Tasks.TaskScheduler.TryExecuteTask(System.Threading.Tasks.Task task)	Unknown	No symbols loaded.
 	Microsoft.VisualStudio.Shell.UI.Internal.dll!Microsoft.VisualStudio.Services.TaskSchedulerService.VsUIThreadBlockableTaskScheduler.DoOneTask(out int dequeuedTaskCount = 1)	Unknown	Symbols loaded.
 	Microsoft.VisualStudio.Shell.UI.Internal.dll!Microsoft.VisualStudio.Services.TaskSchedulerService.VsUINormalPriorityScheduler.OnTaskQueued.AnonymousMethod__2_0()	Unknown	Symbols loaded.
 	WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate callback, object args, int numArgs)	Unknown	Symbols loaded.
 	WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.TryCatchWhen(object source = {System.Windows.Threading.Dispatcher}, System.Delegate callback, object args, int numArgs, System.Delegate catchHandler = null)	Unknown	Symbols loaded.
 	WindowsBase.dll!System.Windows.Threading.DispatcherOperation.InvokeImpl()	Unknown	Symbols loaded.
 	WindowsBase.dll!System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(object state)	Unknown	Symbols loaded.
 	WindowsBase.dll!MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(object obj)	Unknown	Symbols loaded.
 	mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)	Unknown	No symbols loaded.
 	mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)	Unknown	No symbols loaded.
 	mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state)	Unknown	No symbols loaded.
 	WindowsBase.dll!MS.Internal.CulturePreservingExecutionContext.Run(MS.Internal.CulturePreservingExecutionContext executionContext = {MS.Internal.CulturePreservingExecutionContext}, System.Threading.ContextCallback callback, object state)	Unknown	Symbols loaded.
 	WindowsBase.dll!System.Windows.Threading.DispatcherOperation.Invoke()	Unknown	Symbols loaded.
 	WindowsBase.dll!System.Windows.Threading.Dispatcher.ProcessQueue()	Unknown	Symbols loaded.
 	WindowsBase.dll!System.Windows.Threading.Dispatcher.WndProcHook(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam, ref bool handled)	Unknown	Symbols loaded.
 	WindowsBase.dll!MS.Win32.HwndWrapper.WndProc(System.IntPtr hwnd = 0x00250d50, int msg = 49626, System.IntPtr wParam = 0x00000000, System.IntPtr lParam = 0x00000000, ref bool handled = false)	Unknown	Symbols loaded.
 	WindowsBase.dll!MS.Win32.HwndSubclass.DispatcherCallbackOperation(object o)	Unknown	Symbols loaded.
 	WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate callback, object args, int numArgs)	Unknown	Symbols loaded.
 	WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.TryCatchWhen(object source = {System.Windows.Threading.Dispatcher}, System.Delegate callback, object args, int numArgs, System.Delegate catchHandler = null)	Unknown	Symbols loaded.
 	WindowsBase.dll!System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority priority, System.TimeSpan timeout, System.Delegate method, object args, int numArgs)	Unknown	Symbols loaded.
 	WindowsBase.dll!MS.Win32.HwndSubclass.SubclassWndProc(System.IntPtr hwnd = 0x00250d50, int msg = 49626, System.IntPtr wParam = 0x00000000, System.IntPtr lParam = 0x00000000)	Unknown	Symbols loaded.

grokys added a commit to editor-tools/Akavache that referenced this issue May 15, 2018

Use Task.Factory.StartNew to start OperationQueue.
`Task.Start` was previously being used, which uses `TaskScheduler.Current`.
github/VisualStudio#1662 was caused by
`TaskScheduler.Current` being an instance of `VsUINormalPriorityScheduler`
at the time of starting the `OperationQueue`, causing the operation queue
to be run on the UI thread, blocking it.

Use `Task.Factory.StartNew` instead of `Task.Start` to start the
`OperationQueue` thread as this is uses `TaskScheduler.Default` which is
guaranteed to be a thread pool scheduler.

grokys added a commit that referenced this issue May 15, 2018

Updated akavache.
To incorporate editor-tools/Akavache#1

Fixes #1662.

@meaghanlewis meaghanlewis added the bug label May 22, 2018

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