Skip to content
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

Infinite recursion during resource lookup within System.Private.CoreLib #32510

Closed
fanyang-mono opened this issue Feb 18, 2020 · 20 comments · Fixed by #33056 or mono/mono#19101
Closed

Infinite recursion during resource lookup within System.Private.CoreLib #32510

fanyang-mono opened this issue Feb 18, 2020 · 20 comments · Fixed by #33056 or mono/mono#19101

Comments

@fanyang-mono
Copy link
Member

fanyang-mono commented Feb 18, 2020

Steps to Reproduce on linux

  1. Build mono-netcore with llvm JIT: ./build.sh -c Release /p:MonoEnableLLVM=true
  2. Get TE benchmark: git clone https://github.com/aspnet/Benchmarks.git
  3. Build benchmark:
export BenchmarksTargetFramework=netcoreapp5.0
export MicrosoftAspNetCoreAppPackageVersion=5.0.0-alpha.1.20071.6
export MicrosoftNETCoreAppPackageVersion=5.0.0-alpha.1.20070.4
.dotnet/dotnet publish -c Release -f netcoreapp5.0 --self-contained -r linux-x64 <TE_benchmark_git_root>/src/BenchmarksApps/Kestrel/PlatformBenchmarks
cp artifacts/obj/mono/Linux.x64.Release/mono/mini/.libs/libmonosgen-2.0.so <TE_benchmark_git_root>/src/BenchmarksApps/Kestrel/PlatformBenchmarks/bin/Release/netcoreapp5.0/linux-x64/publish/libcoreclr.so
cp artifacts/bin/mono/Linux.x64.Release/System.Private.CoreLib.dll <TE_benchmark_git_root>/src/BenchmarksApps/Kestrel/PlatformBenchmarks/bin/Release/netcoreapp5.0/linux-x64/publish/
  1. Run the app:
cd <TE_benchmark_git_root>/src/BenchmarksApps/Kestrel/PlatformBenchmarks/bin/Release/netcoreapp5.0/linux-x64/publish
export MONO_ENV_OPTIONS="--llvm --server --gc=sgen --gc-params=mode=throughput"
./PlatformBenchmarks

Current Behavior

CLR: Managed code called FailFast, saying "Infinite recursion during resource lookup within System.Private.CoreLib. This may be a bug in System.Private.CoreLib, or potentially in certain extensibility points such as assembly resolve events or CultureInfo names. Resource name: Arg_PlatformNotSupported"

Expected Behavior

No crash

On which platforms did you notice this

[x] macOS
[x] Linux
[ ] Windows

Version Used:
dotnet/runtime 13c1e65

Stacktrace

CLR: Managed code called FailFast, saying "Infinite recursion during resource lookup within System.Private.CoreLib.  This may be a bug in System.Private.CoreLib, or potentially in certain extensibility points such as assembly resolve events or CultureInfo names.  Resource name: Arg_PlatformNotSupported"

Thread 4 (Thread 0x7fa2057ff700 (LWP 31212)):
#0  0x00007fa21032b6d6 in futex_abstimed_wait_cancelable (private=0, abstime=0x0, expected=0, futex_word=0x7fa20eef35b8 <finalizer_sem>) at ../sysdeps/unix/sysv/linux/futex-internal.h:205
#1  do_futex_wait (sem=sem@entry=0x7fa20eef35b8 <finalizer_sem>, abstime=0x0) at sem_waitcommon.c:111
#2  0x00007fa21032b7c8 in __new_sem_wait_slow (sem=0x7fa20eef35b8 <finalizer_sem>, abstime=0x0) at sem_waitcommon.c:181
#3  0x00007fa20d69db98 in mono_os_sem_wait (sem=<optimized out>, flags=MONO_SEM_FLAGS_ALERTABLE) at /home/parallels/Documents/runtime_latest/runtime/src/mono/mono/utils/mono-os-semaphore.h:203
#4  mono_coop_sem_wait (sem=<optimized out>, flags=MONO_SEM_FLAGS_ALERTABLE) at /home/parallels/Documents/runtime_latest/runtime/src/mono/mono/utils/mono-coop-semaphore.h:41
#5  finalizer_thread (unused=<optimized out>) at /home/parallels/Documents/runtime_latest/runtime/src/mono/mono/metadata/gc.c:965
#6  0x00007fa20d6578fa in start_wrapper_internal (start_info=0x0, stack_ptr=<optimized out>) at /home/parallels/Documents/runtime_latest/runtime/src/mono/mono/metadata/threads.c:1232
#7  0x00007fa20d657779 in start_wrapper (data=0x559f18907d30) at /home/parallels/Documents/runtime_latest/runtime/src/mono/mono/metadata/threads.c:1307
#8  0x00007fa2103226db in start_thread (arg=0x7fa2057ff700) at pthread_create.c:463
#9  0x00007fa20f50888f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 3 (Thread 0x7fa209402700 (LWP 31211)):
#0  0x00007fa2103289f3 in futex_wait_cancelable (private=<optimized out>, expected=0, futex_word=0x7fa20ef01bb8 <work_cond+40>) at ../sysdeps/unix/sysv/linux/futex-internal.h:88
#1  __pthread_cond_wait_common (abstime=0x0, mutex=0x7fa20ef01b68 <lock>, cond=0x7fa20ef01b90 <work_cond>) at pthread_cond_wait.c:502
#2  __pthread_cond_wait (cond=0x7fa20ef01b90 <work_cond>, mutex=0x7fa20ef01b68 <lock>) at pthread_cond_wait.c:655
#3  0x00007fa20d6ef793 in mono_os_cond_wait (cond=<optimized out>, mutex=<optimized out>) at /home/parallels/Documents/runtime_latest/runtime/src/mono/mono/utils/mono-os-mutex.h:219
#4  get_work (worker_index=<optimized out>, work_context=<optimized out>, do_idle=<optimized out>, job=<optimized out>) at /home/parallels/Documents/runtime_latest/runtime/src/mono/mono/sgen/sgen-thread-pool.c:165
#5  thread_func (data=0x1) at /home/parallels/Documents/runtime_latest/runtime/src/mono/mono/sgen/sgen-thread-pool.c:196
#6  0x00007fa2103226db in start_thread (arg=0x7fa209402700) at pthread_create.c:463
#7  0x00007fa20f50888f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 2 (Thread 0x7fa209c03700 (LWP 31210)):
#0  0x00007fa2103289f3 in futex_wait_cancelable (private=<optimized out>, expected=0, futex_word=0x7fa20ef01bb8 <work_cond+40>) at ../sysdeps/unix/sysv/linux/futex-internal.h:88
#1  __pthread_cond_wait_common (abstime=0x0, mutex=0x7fa20ef01b68 <lock>, cond=0x7fa20ef01b90 <work_cond>) at pthread_cond_wait.c:502
#2  __pthread_cond_wait (cond=0x7fa20ef01b90 <work_cond>, mutex=0x7fa20ef01b68 <lock>) at pthread_cond_wait.c:655
#3  0x00007fa20d6ef793 in mono_os_cond_wait (cond=<optimized out>, mutex=<optimized out>) at /home/parallels/Documents/runtime_latest/runtime/src/mono/mono/utils/mono-os-mutex.h:219
#4  get_work (worker_index=<optimized out>, work_context=<optimized out>, do_idle=<optimized out>, job=<optimized out>) at /home/parallels/Documents/runtime_latest/runtime/src/mono/mono/sgen/sgen-thread-pool.c:165
#5  thread_func (data=0x0) at /home/parallels/Documents/runtime_latest/runtime/src/mono/mono/sgen/sgen-thread-pool.c:196
#6  0x00007fa2103226db in start_thread (arg=0x7fa209c03700) at pthread_create.c:463
#7  0x00007fa20f50888f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 1 (Thread 0x7fa210742740 (LWP 31209)):
#0  0x00007fa21032d23a in __waitpid (pid=31220, stat_loc=0x7ffdd4a83b7c, options=0) at ../sysdeps/unix/sysv/linux/waitpid.c:30
#1  0x00007fa20d566e21 in dump_native_stacktrace (signal=<optimized out>, mctx=<optimized out>) at /home/parallels/Documents/runtime_latest/runtime/src/mono/mono/mini/mini-posix.c:1113
#2  mono_dump_native_crash_info (signal=<optimized out>, mctx=0x7ffdd4a84690, info=<optimized out>) at /home/parallels/Documents/runtime_latest/runtime/src/mono/mono/mini/mini-posix.c:1157
#3  0x00007fa20d4e6f35 in mono_handle_native_crash (signal=0x7fa20e5fa0fc "SIGABRT", mctx=0x7ffdd4a84690, info=0x7ffdd4a84970) at /home/parallels/Documents/runtime_latest/runtime/src/mono/mono/mini/mini-exceptions.c:3427
#4  0x00007fa20d566275 in sigabrt_signal_handler (_dummy=6, _info=0x7ffdd4a84970, context=0x7ffdd4a84840) at /home/parallels/Documents/runtime_latest/runtime/src/mono/mono/mini/mini-posix.c:234
#5  <signal handler called>
#6  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#7  0x00007fa20f427801 in __GI_abort () at abort.c:79
#8  0x00007fa20d5f94d4 in ves_icall_System_Environment_FailFast (message=..., exception=..., errorSource=..., error=<optimized out>) at /home/parallels/Documents/runtime_latest/runtime/src/mono/mono/metadata/icall.c:7760
#9  0x00007fa20d5fbc04 in ves_icall_System_Environment_FailFast_raw (a0=0x7ffdd4a85220, a1=0x7ffdd4a85228, a2=<optimized out>) at /home/parallels/Documents/runtime_latest/runtime/src/mono/mono/metadata/icall-def-netcore.h:79
#10 0x0000000041774615 in ?? ()
#11 0x00007fa206006d80 in ?? ()
#12 0x00007ffdd4a855f0 in ?? ()
#13 0x0000559f18a2e478 in ?? ()
#14 0x00007fa208402000 in ?? ()
#15 0x00007fa208402000 in ?? ()
#16 0x0000559f18899910 in ?? ()
#17 0x00007ffdd4a85320 in ?? ()
#18 0x00007ffdd4a851e0 in ?? ()
#19 0x00007fa206007030 in ?? ()
#20 0x0000000000000000 in ?? ()

@Dotnet-GitSync-Bot Dotnet-GitSync-Bot added the untriaged New issue has not been triaged by the area owner label Feb 18, 2020
@CoffeeFlux
Copy link
Contributor

CoffeeFlux commented Feb 18, 2020

From Slack:

This happens when you're missing System.Globalization.Native.dylib. You can get rid of it by either building libraries or setting DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1.

@CoffeeFlux CoffeeFlux added area-Build-mono and removed area-GC-mono untriaged New issue has not been triaged by the area owner labels Feb 18, 2020
@marek-safar
Copy link
Contributor

/cc @steveisok

@fanyang-mono
Copy link
Member Author

From Slack:

This happens when you're missing System.Globalization.Native.dylib. You can get rid of it by either building libraries or setting DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1.

This doesn't seem to solve this problem.

@steveisok
Copy link
Member

I can reproduce. And what's weird is that DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1 does not help.

It's important to point out that this all works normal when you don't run under --llvm. I do wonder if there's a loader problem since the exception we're getting suggests that "potentially dangerous" code that throws will cause an infinite loop.

Here's the last bit of the mono trace before it bombs:

Mono: Assembly Loader probing location: '/Users/steve/dev/net5/Benchmarks/src/BenchmarksApps/Kestrel/PlatformBenchmarks/bin/Release/netcoreapp5.0/osx-x64/publish/System.Runtime.Extensions.dll'.
Mono: Image addref System.Runtime.Extensions[0x7fc9bcc0a100] (asmctx DEFAULT) -> /Users/steve/dev/net5/Benchmarks/src/BenchmarksApps/Kestrel/PlatformBenchmarks/bin/Release/netcoreapp5.0/osx-x64/publish/System.Runtime.Extensions.dll[0x7fc9cd802200]: 2
Mono: Predicate: wanted = System.Runtime.Extensions, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
Mono: Predicate: candidate = System.Runtime.Extensions, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
Mono: Predicate: candidate and wanted names match, returning TRUE
Mono: Prepared to set up assembly 'System.Runtime.Extensions' (/Users/steve/dev/net5/Benchmarks/src/BenchmarksApps/Kestrel/PlatformBenchmarks/bin/Release/netcoreapp5.0/osx-x64/publish/System.Runtime.Extensions.dll)
Mono: Loading assembly System.Runtime.Extensions (0x7fc9bcc0a100) into domain PlatformBenchmarks.dll (0x7fc9acd0fcc0) and ALC 0x7fc9acd10730
Mono: Assembly System.Runtime.Extensions[0x7fc9bcc0a100] added to domain PlatformBenchmarks.dll, ref_count=1
Mono: Assembly System.Runtime.Extensions[0x7fc9bcc0a100] added to ALC (0x7fc9acd10730), ref_count=2
Mono: AOT: image '/Users/steve/dev/net5/Benchmarks/src/BenchmarksApps/Kestrel/PlatformBenchmarks/bin/Release/netcoreapp5.0/osx-x64/publish/System.Runtime.Extensions.dll.dylib' not found: dlopen(/Users/steve/dev/net5/Benchmarks/src/BenchmarksApps/Kestrel/PlatformBenchmarks/bin/Release/netcoreapp5.0/osx-x64/publish/System.Runtime.Extensions.dll.dylib, 1): image not found
Mono: AOT: image '/usr/local/lib/mono/aot-cache/amd64/System.Runtime.Extensions.dll.dylib' not found: dlopen(/usr/local/lib/mono/aot-cache/amd64/System.Runtime.Extensions.dll.dylib, 1): image not found
Mono: Assembly Loader loaded assembly from location: '/Users/steve/dev/net5/Benchmarks/src/BenchmarksApps/Kestrel/PlatformBenchmarks/bin/Release/netcoreapp5.0/osx-x64/publish/System.Runtime.Extensions.dll'.
Mono: Config attempting to parse: '/Users/steve/dev/net5/Benchmarks/src/BenchmarksApps/Kestrel/PlatformBenchmarks/bin/Release/netcoreapp5.0/osx-x64/publish/System.Runtime.Extensions.dll.config'.
Mono: Config attempting to parse: '/usr/local/etc/mono/assemblies/System.Runtime.Extensions/System.Runtime.Extensions.config'.
Mono: Assembly Ref addref System.Console[0x7fc9bcc090f0] -> System.Runtime.Extensions[0x7fc9bcc0a100]: 3
Mono: Requesting loading reference 0 (of 2) of /Users/steve/dev/net5/Benchmarks/src/BenchmarksApps/Kestrel/PlatformBenchmarks/bin/Release/netcoreapp5.0/osx-x64/publish/System.Runtime.Extensions.dll
Mono: Loading reference 0 of /Users/steve/dev/net5/Benchmarks/src/BenchmarksApps/Kestrel/PlatformBenchmarks/bin/Release/netcoreapp5.0/osx-x64/publish/System.Runtime.Extensions.dll asmctx DEFAULT, looking for System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e
Mono: Request to load System.Private.CoreLib in (domain 0x7fc9acd0fcc0, alc 0x7fc9acd10730)
Mono: Assembly Ref addref System.Runtime.Extensions[0x7fc9bcc0a100] -> System.Private.CoreLib[0x7fc9acd13200]: 4
CLR: Managed code called FailFast, saying "Infinite recursion during resource lookup within System.Private.CoreLib.  This may be a bug in System.Private.CoreLib, or potentially in certain extensibility points such as assembly resolve events or CultureInfo names.  Resource name: Arg_PlatformNotSupported"

/cc @lambdageek

@marek-safar
Copy link
Contributor

It could be a few issues mixed together. DOTNET_SYSTEM_GLOBALIZATION_INVARIANT requires some hook to be ready very early. We might be not accomodating for that and it's worth checking if it works at all.

There is also some ugly code in https://github.com/dotnet/runtime/blob/master/src/libraries/System.Private.CoreLib/src/System/SR.cs#L95 which might be CoreCLR specific.

/cc @lambdageek

@steveisok
Copy link
Member

I did another pass with and without DOTNET_SYSTEM_GLOBALIZATION_INVARIANT. With the setting I do not see a trace that loads System.Globalization.Native, but without I do.

Without:

Mono: DllImport searching in: 'System.Globalization.Native' ('System.Globalization.Native.dylib').
Mono: Searching for 'GlobalizationNative_GetLocaleName'.
Mono: Probing 'GlobalizationNative_GetLocaleNameW'.
Mono: Could not find 'GlobalizationNative_GetLocaleNameW' due to 'dlsym(0x7fee10603c30, GlobalizationNative_GetLocaleNameW): symbol not found'.
Mono: Probing 'GlobalizationNative_GetLocaleName'.
Mono: Found as 'GlobalizationNative_GetLocaleName'.
Mono: DllImport attempting to load: 'System.Globalization.Native'.
Mono: DllImport searching in: 'System.Globalization.Native' ('System.Globalization.Native.dylib').
Mono: Searching for 'GlobalizationNative_GetSortHandle'.
Mono: Probing 'GlobalizationNative_GetSortHandle'.
Mono: Found as 'GlobalizationNative_GetSortHandle'.
Mono: DllImport attempting to load: 'System.Globalization.Native'.
Mono: DllImport searching in: 'System.Globalization.Native' ('System.Globalization.Native.dylib').
Mono: Searching for 'GlobalizationNative_CloseSortHandle'.
Mono: Probing 'GlobalizationNative_CloseSortHandle'.
Mono: Found as 'GlobalizationNative_CloseSortHandle'.
Mono: DllImport attempting to load: 'System.Globalization.Native'.
Mono: DllImport searching in: 'System.Globalization.Native' ('System.Globalization.Native.dylib').
Mono: Searching for 'GlobalizationNative_GetLocaleInfoString'.
Mono: Probing 'GlobalizationNative_GetLocaleInfoStringW'.
Mono: Could not find 'GlobalizationNative_GetLocaleInfoStringW' due to 'dlsym(0x7fee10603c30, GlobalizationNative_GetLocaleInfoStringW): symbol not found'.
Mono: Probing 'GlobalizationNative_GetLocaleInfoString'.
Mono: Found as 'GlobalizationNative_GetLocaleInfoString'.
CLR: Managed code called FailFast, saying "Infinite recursion during resource lookup within System.Private.CoreLib.  This may be a bug in System.Private.CoreLib, or potentially in certain extensibility points such as assembly resolve events or CultureInfo names.  Resource name: Arg_PlatformNotSupported"

@marek-safar
Copy link
Contributor

Could you paste the log with the setting of the env variable?

@steveisok
Copy link
Member

@CoffeeFlux
Copy link
Contributor

The loader behavior looks fine to me from the logs. In the non-DOTNET_SYSTEM_GLOBALIZATION_INVARIANT case, System.Runtime.Extensions's reference 0 is corlib, and it resolves that and increments the refcount. In the invariant case, we find the pinvoked library and resolve the symbols without issue. These are two rather different code paths, and the pinvoke one is quite simple, so I'm inclined to say the issue probably lies on the managed side. Can you also post the full log for it with DOTNET_SYSTEM_GLOBALIZATION_INVARIANT?

@steveisok
Copy link
Member

That's in the gist above. Do you mean w/o?

@CoffeeFlux
Copy link
Contributor

Yeah without, sorry.

@steveisok
Copy link
Member

steveisok commented Feb 28, 2020

Without DOTNET_SYSTEM_GLOBALIZATION_INVARIANT https://gist.github.com/steveisok/71bfdd52b8e37b1cc0c66332e4ae1171

@CoffeeFlux
Copy link
Contributor

This is reproducible with just a Hello World. Additionally, on OSX I can get a managed stack trace. Crash info below:

MONO_ENV_OPTIONS="--llvm" COMPlus_DebugWriteToStdErr=1 \
	../../../.dotnet-mono/dotnet sample/HelloWorld/bin/HelloWorld.dll
CLR: Managed code called FailFast, saying "Infinite recursion during resource lookup within System.Private.CoreLib.  This may be a bug in System.Private.CoreLib, or potentially in certain extensibility points such as assembly resolve events or CultureInfo names.  Resource name: Arg_PlatformNotSupported"

=================================================================
	Native Crash Reporting
=================================================================
Got a abrt while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.
=================================================================

=================================================================
	Native stacktrace:
=================================================================
	0x10caee052 - /Users/ryan/git/runtime/.dotnet-mono/shared/Microsoft.NETCore.App/5.0.0-alpha.1.20112.1/libcoreclr.dylib : mono_dump_native_crash_info
	0x10ca63e95 - /Users/ryan/git/runtime/.dotnet-mono/shared/Microsoft.NETCore.App/5.0.0-alpha.1.20112.1/libcoreclr.dylib : mono_handle_native_crash
	0x10caed65f - /Users/ryan/git/runtime/.dotnet-mono/shared/Microsoft.NETCore.App/5.0.0-alpha.1.20112.1/libcoreclr.dylib : sigabrt_signal_handler
	0x7fff5f3f2b5d - /usr/lib/system/libsystem_platform.dylib : _sigtramp
	0x0 - Unknown
	0x7fff5f2ac6a6 - /usr/lib/system/libsystem_c.dylib : abort
	0x10cb8241f - /Users/ryan/git/runtime/.dotnet-mono/shared/Microsoft.NETCore.App/5.0.0-alpha.1.20112.1/libcoreclr.dylib : ves_icall_System_Environment_FailFast
	0x10cb84f46 - /Users/ryan/git/runtime/.dotnet-mono/shared/Microsoft.NETCore.App/5.0.0-alpha.1.20112.1/libcoreclr.dylib : ves_icall_System_Environment_FailFast_raw
	0x110051ce4 - Unknown
	0x11004074a - Unknown
	0x10cbc8ef8 - /Users/ryan/git/runtime/.dotnet-mono/shared/Microsoft.NETCore.App/5.0.0-alpha.1.20112.1/libcoreclr.dylib : mono_runtime_invoke_checked
	0x10cbc8d93 - /Users/ryan/git/runtime/.dotnet-mono/shared/Microsoft.NETCore.App/5.0.0-alpha.1.20112.1/libcoreclr.dylib : mono_runtime_object_init_handle
	0x10cb72478 - /Users/ryan/git/runtime/.dotnet-mono/shared/Microsoft.NETCore.App/5.0.0-alpha.1.20112.1/libcoreclr.dylib : mono_exception_from_token
	0x11004dd91 - Unknown

=================================================================
	Telemetry Dumper:
=================================================================
Pkilling 0x123145371099136x from 0x4607038912x
Entering thread summarizer pause from 0x4607038912x
Finished thread summarizer pause from 0x4607038912x.

Waiting for dumping threads to resume

=================================================================
	External Debugger Dump:
=================================================================

=================================================================
	Basic Fault Address Reporting
=================================================================
Memory around native instruction pointer (0x7fff5f3422c2):0x7fff5f3422b2  ff ff c3 90 90 90 b8 48 01 00 02 49 89 ca 0f 05  .......H...I....
0x7fff5f3422c2  73 08 48 89 c7 e9 87 a1 ff ff c3 55 48 89 e5 41  s.H........UH..A
0x7fff5f3422d2  57 41 56 41 55 41 54 53 48 81 ec 88 00 00 00 4d  WAVAUATSH......M
0x7fff5f3422e2  89 cf 49 89 f4 48 8d 05 7a e2 64 36 48 8b 00 48  ..I..H..z.d6H..H

=================================================================
	Managed Stacktrace:
=================================================================
	  at <unknown> <0xffffffff>
	  at System.Environment:FailFast <0x00093>
	  at System.Environment:FailFast <0x00023>
	  at System.SR:InternalGetResourceString <0x00212>
	  at System.SR:GetResourceString <0x00039>
	  at System.SR:GetResourceString <0x0002c>
	  at System.SR:get_Arg_PlatformNotSupported <0x00026>
	  at System.PlatformNotSupportedException:.ctor <0x00025>
	  at System.Object:runtime_invoke_void__this__ <0x00061>
=================================================================

@tannergooding
Copy link
Member

Could this be a similar to: #1716?

In the case of the 1716, it is believed that the failure is due to a runtime vs corelib mismatch.

@CoffeeFlux
Copy link
Contributor

The exception the GetResourceString issue was covering up:

Unhandled Exception:
Nested exception detected.
Original Exception: at System.Runtime.Intrinsics.X86.Sse2/X64.ConvertScalarToVector128UInt64 (ulong) <0x0003f>
at System.Text.ASCIIUtility.NarrowUtf16ToAscii (char*,byte*,ulong) <0x000c8>
at System.Text.Unicode.Utf8Utility.TranscodeToUtf8 (char*,int,byte*,int,char*&,byte*&) <0x00054>
at System.Text.UTF8Encoding.GetBytesFast (char*,int,byte*,int,int&) <0x00058>
at System.Text.Encoding.GetBytes (char*,int,byte*,int,System.Text.EncoderNLS) <0x00079>
at System.Text.EncoderNLS.GetBytes (char*,int,byte*,int,bool) <0x00045>
at System.Text.EncoderNLS.GetBytes (char[],int,int,byte[],int,bool) <0x0007e>
at System.IO.StreamWriter.Flush (bool,bool) <0x000a7>
at System.IO.StreamWriter.WriteLine (string) <0x00281>
at System.IO.TextWriter/SyncTextWriter.WriteLine (string) <0x0001d>
at (wrapper synchronized) System.IO.TextWriter/SyncTextWriter.WriteLine (string) <0x0006e>
at System.Console.WriteLine (string) <0x00031>
at HelloWorld.Program.Main (string[]) <0x00075>

Nested exception:at string.FormatHelper (System.IFormatProvider,string,System.ParamsArray) <0x00149>
at string.Format (string,object) <0x0006e>
at System.SR.Format (string,object) <0x000b1>
at System.Exception.get_Message () <0x00057>
at System.Exception.ToString () <0x00052>




[ERROR] FATAL UNHANDLED EXCEPTION: Nested exception detected.
Original Exception: at System.Runtime.Intrinsics.X86.Sse2/X64.ConvertScalarToVector128UInt64 (ulong) <0x0003f>
at System.Text.ASCIIUtility.NarrowUtf16ToAscii (char*,byte*,ulong) <0x000c8>
at System.Text.Unicode.Utf8Utility.TranscodeToUtf8 (char*,int,byte*,int,char*&,byte*&) <0x00054>
at System.Text.UTF8Encoding.GetBytesFast (char*,int,byte*,int,int&) <0x00058>
at System.Text.Encoding.GetBytes (char*,int,byte*,int,System.Text.EncoderNLS) <0x00079>
at System.Text.EncoderNLS.GetBytes (char*,int,byte*,int,bool) <0x00045>
at System.Text.EncoderNLS.GetBytes (char[],int,int,byte[],int,bool) <0x0007e>
at System.IO.StreamWriter.Flush (bool,bool) <0x000a7>
at System.IO.StreamWriter.WriteLine (string) <0x00281>
at System.IO.TextWriter/SyncTextWriter.WriteLine (string) <0x0001d>
at (wrapper synchronized) System.IO.TextWriter/SyncTextWriter.WriteLine (string) <0x0006e>
at System.Console.WriteLine (string) <0x00031>
at HelloWorld.Program.Main (string[]) <0x00075>

Nested exception:at string.FormatHelper (System.IFormatProvider,string,System.ParamsArray) <0x00149>
at string.Format (string,object) <0x0006e>
at System.SR.Format (string,object) <0x000b1>
at System.Exception.get_Message () <0x00057>
at System.Exception.ToString () <0x00052>

@CoffeeFlux
Copy link
Contributor

cc: @EgorBo

@tannergooding
Copy link
Member

With the latest stack trace, I'd more confidently say this is a duplicate of #1716 (#32510 (comment)).

@CoffeeFlux
Copy link
Contributor

Yep, looks like the same type of failure, though I would expect this is a Mono build issue rather than a true duplicate?

@tannergooding
Copy link
Member

though I would expect this is a Mono build issue rather than a true duplicate?

Yes, probably.

The failure would indicate that the build is pulling a version of S.P.Corelib built for ARM/ARM64 or for 32-bit Unix: https://github.com/dotnet/runtime/blob/master/src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems#L1740-L1756

While the runtime believes that the ISA should be IsSupported=true (the Isa.cs files are recursively implemented, while the Isa.PlatformNotSupported.cs files throw PlatformNotSupportedException).

@CoffeeFlux
Copy link
Contributor

Seems the issue here is purely that corlib uses intrinsics on some platforms that we didn't have implemented, not a platform inconsistency. Egor's PR adds the missing ones, which should fix this particular issue, but we should probably handle that case better and surface the actual exception if possible.

monojenkins pushed a commit to monojenkins/mono that referenced this issue Mar 2, 2020
For now we only implement intrinsics used by corlib internally to optimize code.

Fixes dotnet/runtime#32510 crash.

`ConvertScalarToVector128UInt32/64` is expanded into LLVM's `insertelement`
`ConvertToUInt32/64` is expanded into LLVM's `extractelement`
EgorBo added a commit to mono/mono that referenced this issue Mar 2, 2020
For now we only implement intrinsics used by corlib internally to optimize code.

Fixes dotnet/runtime#32510 crash.

`ConvertScalarToVector128UInt32/64` is expanded into LLVM's `insertelement`
`ConvertToUInt32/64` is expanded into LLVM's `extractelement`

Co-authored-by: Egor Bogatov <egorbo@gmail.com>
@ghost ghost locked as resolved and limited conversation to collaborators Dec 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
6 participants