mono / monodevelop

MonoDevelop is a cross platform .NET IDE
http://www.monodevelop.com
2.84k stars 1.01k forks source link

monodevelop fails to load projects due to sqlite3 issue on Ubuntu 17.10 #4224

Open atsushieno opened 6 years ago

atsushieno commented 6 years ago

On Ubuntu (17.10) monodevelop fails to open a project due to some problem with related to sqlite3 usage in Roslyn:

Stacktrace:

  at <unknown> <0xffffffff>
  at (wrapper managed-to-native) SQLitePCL.SQLite3Provider_e_sqlite3/NativeMethods.sqlite3_open_v2 (byte[],intptr&,int,byte[]) [0x00020] in <effd1c25d63e468eb3b1d32e723a302f>:0
  at SQLitePCL.SQLite3Provider_e_sqlite3.SQLitePCL.ISQLite3Provider.sqlite3_open_v2 (string,intptr&,int,string) [0x0000f] in <effd1c25d63e468eb3b1d32e723a302f>:0
  at SQLitePCL.raw.sqlite3_open_v2 (string,SQLitePCL.sqlite3&,int,string) [0x0000a] in <ee692e8bd0574ccebb8ed2c4862d409c>:0
  at Microsoft.CodeAnalysis.SQLite.Interop.SqlConnection.Create (Microsoft.CodeAnalysis.Host.IPersistentStorageFaultInjector,string) [0x0000f] in /_/src/Workspaces/Core/Desktop/Workspace/SQLite/Interop/SqlConnection.cs:57
  at Microsoft.CodeAnalysis.SQLite.SQLitePersistentStorage.GetConnection () [0x00039] in /_/src/Workspaces/Core/Desktop/Workspace/SQLite/SQLitePersistentStorage.cs:172
  at Microsoft.CodeAnalysis.SQLite.SQLitePersistentStorage.GetPooledConnection () [0x00000] in /_/src/Workspaces/Core/Desktop/Workspace/SQLite/SQLitePersistentStorage.cs:243
  at Microsoft.CodeAnalysis.SQLite.SQLitePersistentStorage.Initialize (Microsoft.CodeAnalysis.Solution) [0x00000] in /_/src/Workspaces/Core/Desktop/Workspace/SQLite/SQLitePersistentStorage.cs:248
  at Microsoft.CodeAnalysis.SQLite.SQLitePersistentStorageService.TryOpenDatabase (Microsoft.CodeAnalysis.Solution,string,string,Microsoft.CodeAnalysis.Host.IPersistentStorage&) [0x00027] in /_/src/Workspaces/Core/Desktop/Workspace/SQLite/SQLitePersistentStorageService.cs:64
  at Microsoft.CodeAnalysis.Storage.AbstractPersistentStorageService.TryCreatePersistentStorage (Microsoft.CodeAnalysis.Solution,string,Microsoft.CodeAnalysis.Host.IPersistentStorage&) [0x00016] in /_/src/Workspaces/Core/Desktop/Workspace/Storage/AbstractPersistentStorageService.cs:173
  at Microsoft.CodeAnalysis.Storage.AbstractPersistentStorageService.TryCreatePersistentStorage (Microsoft.CodeAnalysis.Solution,string) [0x00000] in /_/src/Workspaces/Core/Desktop/Workspace/Storage/AbstractPersistentStorageService.cs:152
  at Microsoft.CodeAnalysis.Storage.AbstractPersistentStorageService.GetStorage (Microsoft.CodeAnalysis.Solution,bool) [0x000d7] in /_/src/Workspaces/Core/Desktop/Workspace/Storage/AbstractPersistentStorageService.cs:97
  at Microsoft.CodeAnalysis.FindSymbols.SyntaxTreeIndex/<PrecalculatedAsync>d__57.MoveNext () [0x00035] in /_/src/Workspaces/Core/Portable/FindSymbols/SyntaxTree/SyntaxTreeIndex_Persistence.cs:128
<snip>

This occurs with any kind of project as far as I tried.

Ubuntu 17.10 / mono 2f21177 / monodevelop b21f597 / sqlite3 3.19.3-3 (system installed package)

atsushieno commented 6 years ago

I wonder if https://github.com/dotnet/roslyn/issues/22996 fixes the issue.

Therzok commented 6 years ago

@atsushieno are you on ARM64? if so this needs fixing https://github.com/ericsink/SQLitePCL.raw/issues/199

I need to open a PR against roslyn to fix this from occurring again https://github.com/dotnet/roslyn/issues/24042

As a workaround, https://github.com/mono/monodevelop/blob/master/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MonoDevelopWorkspace.cs#L112

bump this number to 1gb or so so it doesn't try to use persistent storage

atsushieno commented 6 years ago

It is amd64. And your workaround worked for me. Thanks.

Therzok commented 6 years ago

Hmm, this is entrypoint not found, not dllnotfound. Seems to be another issue.

Therzok commented 6 years ago

@atsushi can you provide a full log with MONO_LOG_MASK=dll? I wonder if we end up loading a system provided .so, rather than the one in main/build/bin

Therzok commented 6 years ago

Opened https://github.com/dotnet/roslyn/pull/25590 which should fix issues like this by logging that persistent storage was disabled via the exception.

atsushieno commented 6 years ago

I'm not sure if this log helps (it doesn't for me) but anyways... https://gist.github.com/atsushieno/7391f28db0768ec113c17b25941e45b3

Therzok commented 6 years ago

Is that log with MONO_LOG_LEVEL=debug MONO_LOG_MASK=dll? @mkrueger mentioned that the .dylib ended up being copies in the bin dir, not the .so

atsushieno commented 6 years ago

I must have missed MONO_LOG_LEVEL...! I have updated gist that now somewhat makes more sense.

Therzok commented 6 years ago

https://github.com/ericsink/SQLitePCL.raw/blob/aacca15515a3d1ab1671379dc9f0af9e0a5bc70a/src/cs/sqlite3_pinvoke.cs#L1524-L1525

and

➜  native git:(master) ✗ nm libe_sqlite3.so | grep sqlite3_open
000000000009a557 T sqlite3_open
000000000009a57d T sqlite3_open16
000000000009a56f T sqlite3_open_v2

Seems like the symbol is there. I'm not sure why this is failing.

xamarin-release-manager commented 6 years ago

Fixed in version 7.6.0.534 (master)

Author: therzok Commit: a871b7ffa725db8c88a473d91981b0cf11624044 (mono/monodevelop)

xamarin-release-manager commented 6 years ago

Fixed in version 7.6.0.534 (master)

Author: therzok Commit: a871b7ffa725db8c88a473d91981b0cf11624044 (mono/monodevelop)

Therzok commented 6 years ago

Seems it's still busted. Will reopen and take a look at it soon.

Therzok commented 6 years ago

As a workaround, committing this: https://github.com/mono/monodevelop/pull/4647