nosami / XSVim

[Obsolete] Vim emulation layer for Xamarin Studio / Visual Studio for Mac
MIT License
158 stars 12 forks source link

MonoDevelop hangs when XSVim is enabled and files are changed externally #233

Closed warwickmm closed 5 years ago

warwickmm commented 6 years ago

When XSVim is enabled and I change a file outside of MonoDevelop (e.g, changing branches with git), MonoDevelop hangs. It remains unresponsive and I have to kill the process. When XSVim is disabled, this issue does not occur. I've tried to disable some of the other extensions without any success.

I've tested this with various versions of MonoDevelop (currently on 7.8), and versions 0.60.2, 0.60.6, and 0.61.0 of XSVim. Unfortunately, the logs do not reveal anything when MonoDevelop hangs. The only errors appear to be unrelated:

ERROR [2018-10-02 22:04:39Z]: Monodoc documentation tree could not be loaded.
System.IO.FileNotFoundException: Could not find file "/usr/lib/monodoc/monodoc.xml"
File name: '/usr/lib/monodoc/monodoc.xml'
  at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) [0x0019e] in <815942dd495d4ccc954b977c1d4bee11>:0
  at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize) [0x00000] in <815942dd495d4ccc954b977c1d4bee11>:0
  at (wrapper remoting-invoke-with-check) System.IO.FileStream..ctor(string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare,int)
  at System.Xml.XmlDownloadManager.GetStream (System.Uri uri, System.Net.ICredentials credentials, System.Net.IWebProxy proxy, System.Net.Cache.RequestCachePolicy cachePolicy) [0x00018] in <754247b7141e4984854d0efa7d375e43>:0
  at System.Xml.XmlUrlResolver.GetEntity (System.Uri absoluteUri, System.String role, System.Type ofObjectToReturn) [0x00032] in <754247b7141e4984854d0efa7d375e43>:0
  at System.Xml.XmlTextReaderImpl.OpenUrlDelegate (System.Object xmlResolver) [0x0000c] in <754247b7141e4984854d0efa7d375e43>:0
  at System.Xml.XmlTextReaderImpl.OpenUrl () [0x0005e] in <754247b7141e4984854d0efa7d375e43>:0
  at System.Xml.XmlTextReaderImpl.Read () [0x00093] in <754247b7141e4984854d0efa7d375e43>:0
  at System.Xml.XmlLoader.Load (System.Xml.XmlDocument doc, System.Xml.XmlReader reader, System.Boolean preserveWhitespace) [0x000a6] in <754247b7141e4984854d0efa7d375e43>:0
  at System.Xml.XmlDocument.Load (System.Xml.XmlReader reader) [0x0002e] in <754247b7141e4984854d0efa7d375e43>:0
  at System.Xml.XmlDocument.Load (System.String filename) [0x00013] in <754247b7141e4984854d0efa7d375e43>:0
  at Monodoc.RootTree.LoadTree (System.String basedir, System.Boolean includeExternal) [0x00043] in <1b68fcca8b6542389171a1d4bc5087c7>:0
  at Monodoc.RootTree.LoadTree () [0x00005] in <1b68fcca8b6542389171a1d4bc5087c7>:0

I'd be curious if this is reproducible at all. If not, then there is likely something wrong with my setup.

nosami commented 6 years ago

I've seen monodevelop hang too when switching branches but I suspected that it is a bug in monodevelop, not XSVim. I'll investigate.

The monodoc error is unrelated, you're correct.

warwickmm commented 5 years ago

I've noticed that sometimes if I wait long enough (a couple minutes), MonoDevelop becomes responsive again. Unfortunately, I'm still unable to find anything in the logs to help determine if this is an XSVim issue or not (other than the problem doesn't appear when XSVim is disabled).

nosami commented 5 years ago

Looks like the hang is happening inside the TextChanged event


"GUI Thread"  at Microsoft.FSharp.Collections.FSharpList`1<T_REF>.get_Empty () [0x00000] in <5a7203e1904cf4daa7450383e103725a>:0
  at Microsoft.FSharp.Collections.PrivateListHelpers.appendToFreshConsTail<a_REF> (Microsoft.FSharp.Collections.FSharpList`1<a_REF>,Microsoft.FSharp.Collections.FSharpList`1<a_REF>) [0x00019] in <5a7203e1904cf4daa7450383e103725a>:0
  at Microsoft.FSharp.Core.Operators.op_Append<T_REF> (Microsoft.FSharp.Collections.FSharpList`1<T_REF>,Microsoft.FSharp.Collections.FSharpList`1<T_REF>) [0x00030] in <5a7203e1904cf4daa7450383e103725a>:0
  at XSVim.Subscriptions/vimState@28.Invoke (XSVim.VimState,char) [0x0004a] in <5c0787832429f754a74503838387075c>:0
  at Microsoft.FSharp.Collections.SeqModule.Fold<char, XSVim.VimState> (Microsoft.FSharp.Core.FSharpFunc`2<XSVim.VimState, Microsoft.FSharp.Core.FSharpFunc`2<char, XSVim.VimState>>,XSVim.VimState,System.Collections.Generic.IEnumerable`1<char>) [0x00036] in <5a7203e1904cf4daa7450383e103725a>:0
  at XSVim.Subscriptions.textChanged (MonoDevelop.Ide.Editor.TextEditor,MonoDevelop.Core.Text.TextChangeEventArgs) [0x000ff] in <5c0787832429f754a74503838387075c>:0
  at <StartupCode$XSVim>.$Addin/textChanged@121-4.Invoke (MonoDevelop.Core.Text.TextChangeEventArgs) [0x00007] in <5c0787832429f754a74503838387075c>:0
  at Microsoft.FSharp.Control.CommonExtensions/SubscribeToObservable@1741<T_REF>.System-IObserver`1-OnNext (T_REF) [0x00007] in <5a7203e1904cf4daa7450383e103725a>:0
  at Microsoft.FSharp.Core.CompilerServices.RuntimeHelpers/h@349<TArgs_REF>.Invoke (object,TArgs_REF) [0x00007] in <5a7203e1904cf4daa7450383e103725a>:0
  at <StartupCode$XSVim>.$Addin/textChanged@121-3.Invoke (object,MonoDevelop.Core.Text.TextChangeEventArgs) [0x00008] in <5c0787832429f754a74503838387075c>:0
  at (wrapper delegate-invoke) System.EventHandler`1<TEventArgs_REF>.invoke_void_object_TEventArgs (object,TEventArgs_REF) [0x0006b] in <98fac219bd4e453693d76fda7bd96ab0>:0
  at Mono.TextEditor.TextDocument.OnTextBufferChanged (object,Microsoft.VisualStudio.Text.TextContentChangedEventArgs) [0x000e7] in /Users/vsts/agent/2.142.1/work/1/s/monodevelop/main/src/core/Mono.TextEditor.Shared/Mono.TextEditor/Document/TextDocument.cs:297
  at Microsoft.VisualStudio.Text.Utilities.GuardedOperations.RaiseEvent<TArgs_REF> (object,System.EventHandler`1<TArgs_REF>,TArgs_REF) [0x0001f] in C:\vs-editor-api\src\Text\Util\TextDataUtil\GuardedOperations.cs:516
  at Microsoft.VisualStudio.Text.Implementation.BaseBuffer.RawRaiseEvent (Microsoft.VisualStudio.Text.TextContentChangedEventArgs,bool) [0x000cc] in C:\vs-editor-api\src\Text\Impl\TextModel\BaseBuffer.cs:1054
  at Microsoft.VisualStudio.Text.Implementation.BaseBuffer/TextContentChangedEventRaiser.RaiseEvent (Microsoft.VisualStudio.Text.Implementation.BaseBuffer,bool) [0x00000] in C:\vs-editor-api\src\Text\Impl\TextModel\BaseBuffer.cs:51
  at Microsoft.VisualStudio.Text.Implementation.BufferGroup.RaiseEvents () [0x00026] in C:\vs-editor-api\src\Text\Impl\TextModel\BufferGroup.cs:596
  at Microsoft.VisualStudio.Text.Implementation.BufferGroup.FinishEdit () [0x00022] in C:\vs-editor-api\src\Text\Impl\TextModel\BufferGroup.cs:553
  at Microsoft.VisualStudio.Text.Implementation.BaseBuffer/TextBufferEdit.Apply () [0x00011] in C:\vs-editor-api\src\Text\Impl\TextModel\BaseBuffer.cs:158
  at Microsoft.VisualStudio.Text.Implementation.BaseBuffer.Replace (Microsoft.VisualStudio.Text.Span,string) [0x00010] in C:\vs-editor-api\src\Text\Impl\TextModel\BaseBuffer.cs:940
  at Mono.TextEditor.TextDocument.ReplaceText (int,int,string) [0x00097] in /Users/vsts/agent/2.142.1/work/1/s/monodevelop/main/src/core/Mono.TextEditor.Shared/Mono.TextEditor/Document/TextDocument.cs:423
  at MonoDevelop.SourceEditor.SourceEditorView.Load (string,System.Text.Encoding,bool) [0x000d8] in /Users/vsts/agent/2.142.1/work/1/s/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorView.cs:924
  at MonoDevelop.SourceEditor.SourceEditorView.Load (MonoDevelop.Ide.Gui.FileOpenInformation) [0x00000] in /Users/vsts/agent/2.142.1/work/1/s/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorView.cs:850
  at MonoDevelop.Ide.Editor.TextEditorViewContent/<Load>d__20.MoveNext () [0x0004e] in /Users/vsts/agent/2.142.1/work/1/s/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/TextEditorViewContent.cs:219
  at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start<MonoDevelop.Ide.Editor.TextEditorViewContent/<Load>d__20> (MonoDevelop.Ide.Editor.TextEditorViewContent/<Load>d__20&) [0x0002c] in /Users/builder/jenkins/workspace/build-package-osx-mono/2018-06/external/bockbuild/builds/mono-x64/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:316
  at MonoDevelop.Ide.Editor.TextEditorViewContent.Load (MonoDevelop.Ide.Gui.FileOpenInformation) [0x0002f] in <26c0ef674695474cb9f20b4eb6173531>:0
  at MonoDevelop.Ide.Gui.Document/<ReloadTask>d__72.MoveNext () [0x00050] in /Users/vsts/agent/2.142.1/work/1/s/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Document.cs:403
  at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start<MonoDevelop.Ide.Gui.Document/<ReloadTask>d__72> (MonoDevelop.Ide.Gui.Document/<ReloadTask>d__72&) [0x0002c] in /Users/builder/jenkins/workspace/build-package-osx-mono/2018-06/external/bockbuild/builds/mono-x64/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:316
  at MonoDevelop.Ide.Gui.Document.ReloadTask () [0x00027] in <26c0ef674695474cb9f20b4eb6173531>:0
  at MonoDevelop.Ide.Gui.Document/<>c__DisplayClass70_0.<RunAsyncOperation>b__0 (System.Threading.Tasks.Task) [0x00000] in /Users/vsts/agent/2.142.1/work/1/s/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Document.cs:387
  at System.Threading.Tasks.ContinuationResultTaskFromTask`1<TResult_REF>.InnerInvoke () [0x00024] in /Users/builder/jenkins/workspace/build-package-osx-mono/2018-06/external/bockbuild/builds/mono-x64/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/TaskContinuation.cs:110
  at System.Threading.Tasks.Task.Execute () [0x00000] in /Users/builder/jenkins/workspace/build-package-osx-mono/2018-06/external/bockbuild/builds/mono-x64/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs:2344
  at System.Threading.Tasks.Task.ExecutionContextCallback (object) [0x00006] in /Users/builder/jenkins/workspace/build-package-osx-mono/2018-06/external/bockbuild/builds/mono-x64/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs:2488
  at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool) [0x00071] in /Users/builder/jenkins/workspace/build-package-osx-mono/2018-06/external/bockbuild/builds/mono-x64/mcs/class/referencesource/mscorlib/system/threading/executioncontext.cs:961
  at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool) [0x00000] in /Users/builder/jenkins/workspace/build-package-osx-mono/2018-06/external/bockbuild/builds/mono-x64/mcs/class/referencesource/mscorlib/system/threading/executioncontext.cs:908
  at System.Threading.Tasks.Task.ExecuteWithThreadLocal (System.Threading.Tasks.Task&) [0x00034] in /Users/builder/jenkins/workspace/build-package-osx-mono/2018-06/external/bockbuild/builds/mono-x64/mcs/class/corlib/corert/Task.cs:72
  at System.Threading.Tasks.Task.ExecuteEntry (bool) [0x0004a] in /Users/builder/jenkins/workspace/build-package-osx-mono/2018-06/external/bockbuild/builds/mono-x64/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs:2410
  at System.Threading.Tasks.TaskScheduler.TryExecuteTask (System.Threading.Tasks.Task) [0x00014] in /Users/builder/jenkins/workspace/build-package-osx-mono/2018-06/external/bockbuild/builds/mono-x64/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/TaskScheduler.cs:426
  at MonoDevelop.Core.SynchronizationContextTaskScheduler.PostCallback (object) [0x00000] in /Users/vsts/agent/2.142.1/work/1/s/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Core/SynchronizationContextTaskScheduler.cs:55
  at MonoDevelop.Ide.DispatchService/GtkSynchronizationContext/TimeoutProxy.HandlerInternal (intptr) [0x00014] in /Users/vsts/agent/2.142.1/work/1/s/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/DispatchService.cs:77
  at (wrapper native-to-managed) MonoDevelop.Ide.DispatchService/GtkSynchronizationContext/TimeoutProxy.HandlerInternal (intptr) [0x00021] in <26c0ef674695474cb9f20b4eb6173531>:0
  at <unknown> <0xffffffff>
  at (wrapper managed-to-native) Gtk.Application.gtk_main () [0x00008] in <40f46e55eb67454ab904dc9e5644a3a1>:0
  at Gtk.Application.Run () [0x00001] in /Users/builder/jenkins/workspace/build-package-osx-mono/2018-06/external/bockbuild/builds/gtk-sharp-None/gtk/Application.cs:145
  at MonoDevelop.Ide.IdeApp.Run () [0x00006] in /Users/vsts/agent/2.142.1/work/1/s/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/Ide.cs:464
  at MonoDevelop.Ide.IdeStartup.Run (MonoDevelop.Ide.MonoDevelopOptions) [0x00a1e] in /Users/vsts/agent/2.142.1/work/1/s/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/IdeStartup.cs:385
  at MonoDevelop.Ide.IdeStartup.Main (string[],MonoDevelop.Ide.Extensions.IdeCustomizer) [0x000bc] in /Users/vsts/agent/2.142.1/work/1/s/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/IdeStartup.cs:825
  at Xamarin.Startup.MainClass.Main (string[]) [0x00000] in /Users/vsts/agent/2.142.1/work/1/s/md-addins/Xamarin.Startup/Main.cs:11
  at (wrapper runtime-invoke) <Module>.runtime_invoke_int_object (object,intptr,intptr,intptr) [0x00057] in <8c8f06d5757b43d9a297e77dd9335da6>:0
nosami commented 5 years ago

This was easy to replicate without switching branches by copying and pasting a very large amount of text into a buffer.

Fixed now - thanks for reporting!

warwickmm commented 5 years ago

Thanks for the fix!

warwickmm commented 5 years ago

Thanks for the fix!