dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
15.19k stars 4.72k forks source link

Mono is crashing on the newly added tests for generic Attributes #66168

Open buyaa-n opened 2 years ago

buyaa-n commented 2 years ago

Mono is crashing on the newly added tests even though they were disabled on Mono:

#13 0x0000007f8d2cfbdc in mono_assertion_message_unreachable (file=0x64 <error: Cannot access memory at address 0x64>, line=6) at /__w/1/s/src/mono/mono/eglib/goutput.c:234
#14 0x0000007f8d115120 in custom_attr_class_name_from_method_token (image=0x5589355e20, method_token=167772165, nspace=0x7fc25c2d58, class_name=0x7fc25c2d50, assembly_token=<optimized out>) at /__w/1/s/src/mono/mono/metadata/custom-attrs.c:2441

To unblock the PR the failing tests are commented out https://github.com/dotnet/runtime/blob/0bfa71cc6331f9fc4be45a531447d4c0ec97134a/src/tests/reflection/GenericAttribute/GenericAttributeTests.cs#L21-L30

Originally posted by @jkotas in https://github.com/dotnet/runtime/issues/65237#issuecomment-1041935039

More logs
Console log: 'System.Runtime.Tests' from job 899b0f8c-0334-4813-ac69-22e8063fd542 workitem 9fb6efd4-0b69-4b14-9ffe-1fa056130f4f (osx.1200.amd64.open) executed on machine dci-mac-build-384.local
+ ./RunTests.sh --runtime-path /tmp/helix/working/A19808BE/p
----- start Wed Feb 16 06:24:48 PST 2022 =============== To repro directly: =====================================================
pushd .
/tmp/helix/working/A19808BE/p/dotnet exec --runtimeconfig System.Runtime.Tests.runtimeconfig.json --depsfile System.Runtime.Tests.deps.json xunit.console.dll System.Runtime.Tests.dll -xml testResults.xml -nologo -nocolor -notrait category=IgnoreForCI -notrait category=OuterLoop -notrait category=failing 
popd
===========================================================================================================
/private/tmp/helix/working/A19808BE/w/BAC009DC/e /private/tmp/helix/working/A19808BE/w/BAC009DC/e
* Assertion: should not be reached at /Users/runner/work/1/s/src/mono/mono/metadata/custom-attrs.c:2441

=================================================================
    Native Crash Reporting
=================================================================
Got a SIGABRT 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:
=================================================================
    0x10ed5f254 - /private/tmp/helix/working/A19808BE/p/shared/Microsoft.NETCore.App/7.0.0/libcoreclr.dylib : mono_dump_native_crash_info
    0x10ed0077e - /private/tmp/helix/working/A19808BE/p/shared/Microsoft.NETCore.App/7.0.0/libcoreclr.dylib : mono_handle_native_crash
    0x10ee02968 - /private/tmp/helix/working/A19808BE/p/shared/Microsoft.NETCore.App/7.0.0/libcoreclr.dylib : sigabrt_signal_handler.cold.1
    0x10ed5eb88 - /private/tmp/helix/working/A19808BE/p/shared/Microsoft.NETCore.App/7.0.0/libcoreclr.dylib : sigabrt_signal_handler
    0x7ff80c7fde2d - /usr/lib/system/libsystem_platform.dylib : _sigtramp
    0x1 - Unknown
    0x7ff80c734d10 - /usr/lib/system/libsystem_c.dylib : abort
    0x10edaa788 - /private/tmp/helix/working/A19808BE/p/shared/Microsoft.NETCore.App/7.0.0/libcoreclr.dylib : monoeg_assert_abort
    0x10ebe46ea - /private/tmp/helix/working/A19808BE/p/shared/Microsoft.NETCore.App/7.0.0/libcoreclr.dylib : mono_log_write_logfile
    0x10edaacf2 - /private/tmp/helix/working/A19808BE/p/shared/Microsoft.NETCore.App/7.0.0/libcoreclr.dylib : monoeg_g_logv_nofree
    0x10edaae6f - /private/tmp/helix/working/A19808BE/p/shared/Microsoft.NETCore.App/7.0.0/libcoreclr.dylib : monoeg_assertion_message
    0x10edaaec7 - /private/tmp/helix/working/A19808BE/p/shared/Microsoft.NETCore.App/7.0.0/libcoreclr.dylib : mono_assertion_message_unreachable
    0x10ebb20a0 - /private/tmp/helix/working/A19808BE/p/shared/Microsoft.NETCore.App/7.0.0/libcoreclr.dylib : mono_class_metadata_foreach_custom_attr
    0x10eb11355 - /private/tmp/helix/working/A19808BE/p/shared/Microsoft.NETCore.App/7.0.0/libcoreclr.dylib : mono_assembly_request_load_from
    0x10eb10f8f - /private/tmp/helix/working/A19808BE/p/shared/Microsoft.NETCore.App/7.0.0/libcoreclr.dylib : mono_assembly_request_open
    0x10ed3a7b9 - /private/tmp/helix/working/A19808BE/p/shared/Microsoft.NETCore.App/7.0.0/libcoreclr.dylib : mono_core_preload_hook
    0x10eb13776 - /private/tmp/helix/working/A19808BE/p/shared/Microsoft.NETCore.App/7.0.0/libcoreclr.dylib : invoke_assembly_preload_hook
    0x10eb10207 - /private/tmp/helix/working/A19808BE/p/shared/Microsoft.NETCore.App/7.0.0/libcoreclr.dylib : mono_assembly_request_byname
    0x10eb0d345 - /private/tmp/helix/working/A19808BE/p/shared/Microsoft.NETCore.App/7.0.0/libcoreclr.dylib : ves_icall_System_Reflection_Assembly_InternalLoad
    0x10eb43f55 - /private/tmp/helix/working/A19808BE/p/shared/Microsoft.NETCore.App/7.0.0/libcoreclr.dylib : ves_icall_System_Reflection_Assembly_InternalLoad_raw
    0x112ae67ba - Unknown
    0x112506773 - Unknown
    0x10eaf033b - Unknown
    0x10eaf04c1 - Unknown
    0x10ec5c592 - /private/tmp/helix/working/A19808BE/p/shared/Microsoft.NETCore.App/7.0.0/libcoreclr.dylib : mono_jit_runtime_invoke
    0x10eb7a9c8 - /private/tmp/helix/working/A19808BE/p/shared/Microsoft.NETCore.App/7.0.0/libcoreclr.dylib : mono_runtime_invoke_checked
    0x10eb82a1c - /private/tmp/helix/working/A19808BE/p/shared/Microsoft.NETCore.App/7.0.0/libcoreclr.dylib : do_exec_main_checked
    0x10ecbabf2 - /private/tmp/helix/working/A19808BE/p/shared/Microsoft.NETCore.App/7.0.0/libcoreclr.dylib : mono_jit_exec
    0x10ecbe226 - /private/tmp/helix/working/A19808BE/p/shared/Microsoft.NETCore.App/7.0.0/libcoreclr.dylib : mono_main
    0x10ed3a3c3 - /private/tmp/helix/working/A19808BE/p/shared/Microsoft.NETCore.App/7.0.0/libcoreclr.dylib : monovm_execute_assembly
    0x10e6c847d - /private/tmp/helix/working/A19808BE/p/shared/Microsoft.NETCore.App/7.0.0/libhostpolicy.dylib : _Z19run_app_for_contextRK20hostpolicy_context_tiPPKc
    0x10e6c92e1 - /private/tmp/helix/working/A19808BE/p/shared/Microsoft.NETCore.App/7.0.0/libhostpolicy.dylib : corehost_main
    0x10e6560c5 - /private/tmp/helix/working/A19808BE/p/host/fxr/7.0.0/libhostfxr.dylib : _ZN10fx_muxer_t24handle_exec_host_commandERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEERK19host_startup_info_tS8_RKNS0_13unordered_mapI13known_optionsNS0_6vectorIS6_NS4_IS6_EEEE18known_options_hashNS0_8equal_toISD_EENS4_INS0_4pairIKSD
    0x10e654ead - /private/tmp/helix/working/A19808BE/p/host/fxr/7.0.0/libhostfxr.dylib : _ZN10fx_muxer_t7executeENSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEiPPKcRK19host_startup_info_tPciPi
    0x10e6518a8 - /private/tmp/helix/working/A19808BE/p/host/fxr/7.0.0/libhostfxr.dylib : hostfxr_main_startupinfo
    0x10e49fa92 - /private/tmp/helix/working/A19808BE/p/dotnet : _Z9exe_startiPPKc
    0x10e49fc50 - /private/tmp/helix/working/A19808BE/p/dotnet : main
    0x11b8384fe - Unknown

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

=================================================================
    Basic Fault Address Reporting
=================================================================
Memory around native instruction pointer (0x7ff80c7b2112):0x7ff80c7b2102  ff ff c3 90 90 90 b8 48 01 00 02 49 89 ca 0f 05  .......H...I....
0x7ff80c7b2112  73 08 48 89 c7 e9 d5 a1 ff ff c3 90 90 90 b8 53  s.H............S
0x7ff80c7b2122  00 00 02 49 89 ca 0f 05 73 08 48 89 c7 e9 bd a1  ...I....s.H.....
0x7ff80c7b2132  ff ff c3 90 90 90 b8 83 01 00 02 49 89 ca 0f 05  ...........I....

=================================================================
    Managed Stacktrace:
=================================================================
      at  <0xffffffff>
      at System.Reflection.Assembly:InternalLoad <0x00089>
      at System.Reflection.Assembly:Load <0x00092>
      at System.Reflection.Assembly:Load <0x0006a>
      at Xunit.ConsoleClient.ConsoleRunner:GetAvailableRunnerReporters <0x00452>
      at Xunit.ConsoleClient.ConsoleRunner:EntryPoint <0x000d2>
      at Xunit.ConsoleClient.Program:Main <0x0013a>
      at :runtime_invoke_int_object <0x000b0>
=================================================================
./RunTests.sh: line 168: 65211 Abort trap: 6           "$RUNTIME_PATH/dotnet" exec --runtimeconfig System.Runtime.Tests.runtimeconfig.json --depsfile System.Runtime.Tests.deps.json xunit.console.dll System.Runtime.Tests.dll -xml testResults.xml -nologo -nocolor -notrait category=IgnoreForCI -notrait category=OuterLoop -notrait category=failing $RSP_FILE
/private/tmp/helix/working/A19808BE/w/BAC009DC/e

link

steveisok commented 2 years ago

/cc @SamMonoRT

SamMonoRT commented 2 years ago

@naricc - this was another case of a disabled test still run in CI

lambdageek commented 2 years ago

Update or possibly not. This is going to affect https://github.com/dotnet/runtime/issues/70133 if the proposal lands with [MarshalAs<JSType.Number>]-style attributes

The assertion is only in ref-emit custom attribute code - so generic custom attributes in regular c# files might be ok?

And specifically for [MarshalAs<T>], it wouldn't be Mono looking at the attributes, it would be the source generator.

So this is worth fixing, but it's not a blocker for the JS marshaller work

SamMonoRT commented 1 year ago

Moving to 9.0.0, we'll consider a backport based on the actual fix.