Skip to content
This repository has been archived by the owner on Oct 4, 2021. It is now read-only.

FileWatcherService locks UI Thread on linux. #6898

Closed
mkrueger opened this issue Jan 15, 2019 · 2 comments
Closed

FileWatcherService locks UI Thread on linux. #6898

mkrueger opened this issue Jan 15, 2019 · 2 comments

Comments

@mkrueger
Copy link
Contributor

mkrueger commented Jan 15, 2019

I get 100% UI locks on linux since some days now. Opening/Closing files lock.

The main issue I see is:

  at (wrapper managed-to-native) object.__icall_wrapper_mono_threads_state_poll () [0x00006] in <69e8aa7a1d73495d92adb99b890f03fc>:0
  at System.Marvin.ComputeHash32 (byte&,int,ulong) [0x00011] in /home/mkrueger/work/install/mono/external/corefx/src/Common/src/CoreLib/System/Marvin.cs:39
  at string.GetHashCode () [0x00000] in /home/mkrueger/work/install/mono/external/corefx/src/Common/src/CoreLib/System/String.Comparison.cs:858
  at System.Collections.Hashtable.GetHash (object) [0x00015] in /home/mkrueger/work/install/mono/external/corefx/src/System.Runtime.Extensions/src/System/Collections/Hashtable.cs:812
  at System.Collections.Hashtable.InitHash (object,int,uint&,uint&) [0x00000] in /home/mkrueger/work/install/mono/external/corefx/src/System.Runtime.Extensions/src/System/Collections/Hashtable.cs:417
  at System.Collections.Hashtable.get_Item (object) [0x0001a] in /home/mkrueger/work/install/mono/external/corefx/src/System.Runtime.Extensions/src/System/Collections/Hashtable.cs:668
  at System.IO.DefaultWatcher.IterateAndModifyFilesData (System.IO.DefaultWatcherData,string,bool,string[]) [0x0001f] in /home/mkrueger/work/install/mono/mcs/class/System/System.IO/DefaultWatcher.cs:232
  at System.IO.DefaultWatcher.DoFiles (System.IO.DefaultWatcherData,string,bool) [0x000a0] in /home/mkrueger/work/install/mono/mcs/class/System/System.IO/DefaultWatcher.cs:224
  at System.IO.DefaultWatcher.DoFiles (System.IO.DefaultWatcherData,string,bool) [0x00022] in /home/mkrueger/work/install/mono/mcs/class/System/System.IO/DefaultWatcher.cs:207
  at System.IO.DefaultWatcher.DoFiles (System.IO.DefaultWatcherData,string,bool) [0x00022] in /home/mkrueger/work/install/mono/mcs/class/System/System.IO/DefaultWatcher.cs:207
  at System.IO.DefaultWatcher.DoFiles (System.IO.DefaultWatcherData,string,bool) [0x00022] in /home/mkrueger/work/install/mono/mcs/class/System/System.IO/DefaultWatcher.cs:207
  at System.IO.DefaultWatcher.DoFiles (System.IO.DefaultWatcherData,string,bool) [0x00022] in /home/mkrueger/work/install/mono/mcs/class/System/System.IO/DefaultWatcher.cs:207
  at System.IO.DefaultWatcher.DoFiles (System.IO.DefaultWatcherData,string,bool) [0x00022] in /home/mkrueger/work/install/mono/mcs/class/System/System.IO/DefaultWatcher.cs:207
  at System.IO.DefaultWatcher.DoFiles (System.IO.DefaultWatcherData,string,bool) [0x00022] in /home/mkrueger/work/install/mono/mcs/class/System/System.IO/DefaultWatcher.cs:207
  at System.IO.DefaultWatcher.UpdateDataAndDispatch (System.IO.DefaultWatcherData,bool) [0x00040] in /home/mkrueger/work/install/mono/mcs/class/System/System.IO/DefaultWatcher.cs:184
  at System.IO.DefaultWatcher.StartDispatching (object) [0x00117] in /home/mkrueger/work/install/mono/mcs/class/System/System.IO/DefaultWatcher.cs:116
  at System.IO.FileSystemWatcher.Start () [0x00012] in /home/mkrueger/work/install/mono/mcs/class/System/System.IO/FileSystemWatcher.cs:554
  at System.IO.FileSystemWatcher.set_EnableRaisingEvents (bool) [0x0003d] in /home/mkrueger/work/install/mono/mcs/class/System/System.IO/FileSystemWatcher.cs:237

I could fix that in mono with mono/mono#12432

Now I can open/close files without dead lock - I surely need to investigate our side (the FileSystemWatcherService) a bit, but at least the IDE is usuable with that mono patch.


Full thread dump: https://gist.github.com/mkrueger/363d60571f78ecc606fdcd11d33cb805

VS bug #768784

@mkrueger mkrueger self-assigned this Jan 15, 2019
mkrueger added a commit that referenced this issue Jan 15, 2019
conjunction with the mono patch:
mono/mono#12432

I think the mono patch is the real fix here but I optimized the
UpdateWatchers.
Therzok pushed a commit that referenced this issue Jan 18, 2019
)

* Fixes issue #6898 FileWatcherService locks UI Thread on linux. In
conjunction with the mono patch:
mono/mono#12432

I think the mono patch is the real fix here but I optimized the
UpdateWatchers.

* Update FileWatcherService.cs

* [Core] Fixed unit tests.

The toRemove list can easily be converted to a static field as well -
only used in a static method inside a lock without a way of recursion.
@xamarin-release-manager
Copy link
Contributor

Fixed in version 8.0.0.1193 (master)

Author: Mike Krüger
Commit: 02b2ca3 (mono/monodevelop)

@xamarin-release-manager
Copy link
Contributor

Fixed in version 8.0.0.1235 (release-8.0)

Author: Mike Krüger
Commit: 02b2ca3 (mono/monodevelop)

baulig pushed a commit to mono/mono that referenced this issue Jan 28, 2019
mono/monodevelop#6898

Not sure if it's the root of the problem but it surely fixes the dead lock on my machine.
jonpryor pushed a commit to dotnet/android that referenced this issue Apr 24, 2019
Bumps to mono/api-snapshot@ae01378
Bumps to mono/reference-assemblies@e5173a5
Bumps to mono/bockbuild@d30329d
Bumps to mono/boringssl@3d87996
Bumps to mono/corefx@72f7d76
Bumps to mono/corert@1b7d4a1
Bumps to mono/helix-binaries@7e893ea
Bumps to mono/illinker-test-assets@f21ff68
Bumps to dotnet/linker@13d864e
Bumps to mono/llvm@1aaaaa5 [mono]
Bumps to mono/llvm@2c2cffe [xamarin-android]
Bumps to mono/NUnitLite@0029561
Bumps to mono/roslyn-binaries@0bbc9b4
Bumps to mono/xunit-binaries@8f6e62e

	$ git diff --shortstat 886c4901..e66c7667      # mono
        3597 files changed, 350850 insertions(+), 91128 deletions(-)
	$ git diff --shortstat 349752c464c5fc93b32e7d45825f2890c85c8b7d..2c2cffedf01e0fe266b9aaad2c2563e05b750ff4
	 240 files changed, 18562 insertions(+), 6581 deletions(-)

Context: https://github.com/dotnet/coreclr/issues/22046

Fixes: CVE 2018-8292 on macOS
Fixes: http://work.devdiv.io/737323
Fixes: https://github.com/dotnet/corefx/issues/33965
Fixes: dotnet/standard#642
Fixes: mono/mono#6997
Fixes: mono/mono#7326
Fixes: mono/mono#7517
Fixes: mono/mono#7750
Fixes: mono/mono#7859
Fixes: mono/mono#8360
Fixes: mono/mono#8460
Fixes: mono/mono#8766
Fixes: mono/mono#8922
Fixes: mono/mono#9418
Fixes: mono/mono#9507
Fixes: mono/mono#9951
Fixes: mono/mono#10024
Fixes: mono/mono#10030
Fixes: mono/mono#10038
Fixes: mono/mono#10448
Fixes: mono/mono#10735
Fixes: mono/mono#10735
Fixes: mono/mono#10737
Fixes: mono/mono#10743
Fixes: mono/mono#10834
Fixes: mono/mono#10837
Fixes: mono/mono#10838
Fixes: mono/mono#10863
Fixes: mono/mono#10945
Fixes: mono/mono#11020
Fixes: mono/mono#11021
Fixes: mono/mono#11021
Fixes: mono/mono#11049
Fixes: mono/mono#11091
Fixes: mono/mono#11095
Fixes: mono/mono#11123
Fixes: mono/mono#11138
Fixes: mono/mono#11146
Fixes: mono/mono#11202
Fixes: mono/mono#11214
Fixes: mono/mono#11317
Fixes: mono/mono#11326
Fixes: mono/mono#11378
Fixes: mono/mono#11385
Fixes: mono/mono#11478
Fixes: mono/mono#11479
Fixes: mono/mono#11488
Fixes: mono/mono#11489
Fixes: mono/mono#11527
Fixes: mono/mono#11529
Fixes: mono/mono#11596
Fixes: mono/mono#11603
Fixes: mono/mono#11613
Fixes: mono/mono#11623
Fixes: mono/mono#11663
Fixes: mono/mono#11681
Fixes: mono/mono#11684
Fixes: mono/mono#11693
Fixes: mono/mono#11697
Fixes: mono/mono#11779
Fixes: mono/mono#11809
Fixes: mono/mono#11858
Fixes: mono/mono#11895
Fixes: mono/mono#11898
Fixes: mono/mono#11898
Fixes: mono/mono#11965
Fixes: mono/mono#12182
Fixes: mono/mono#12193
Fixes: mono/mono#12218
Fixes: mono/mono#12235
Fixes: mono/mono#12263
Fixes: mono/mono#12307
Fixes: mono/mono#12331
Fixes: mono/mono#12362
Fixes: mono/mono#12374
Fixes: mono/mono#12402
Fixes: mono/mono#12421
Fixes: mono/mono#12461
Fixes: mono/mono#12479
Fixes: mono/mono#12479
Fixes: mono/mono#12552
Fixes: mono/mono#12603
Fixes: mono/mono#12747
Fixes: mono/mono#12831
Fixes: mono/mono#12843
Fixes: mono/mono#12881
Fixes: mono/mono#13030
Fixes: mono/mono#13284
Fixes: mono/mono#13297
Fixes: mono/mono#13455
Fixes: mono/mono#13460
Fixes: mono/mono#13478
Fixes: mono/mono#13479
Fixes: mono/mono#13522
Fixes: mono/mono#13607
Fixes: mono/mono#13610
Fixes: mono/mono#13610
Fixes: mono/mono#13639
Fixes: mono/mono#13672
Fixes: mono/mono#13834
Fixes: mono/mono#13878
Fixes: mono/mono#6352
Fixes: mono/monodevelop#6898
Fixes: xamarin/maccore#1069
Fixes: xamarin/maccore#1407
Fixes: xamarin/maccore#604
Fixes: xamarin/xamarin-macios#4984
Fixes: xamarin/xamarin-macios#5289
Fixes: xamarin/xamarin-macios#5363
Fixes: xamarin/xamarin-macios#5381
Fixes: https://issuetracker.unity3d.com/issues/editor-crashes-with-g-logv-when-entering-play-mode-with-active-flowcanvas-script
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants