dotnet / runtime

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

[mono] FullAOT runtime test failures: condition `i < mcount' not met #57512

Closed imhameed closed 2 years ago

imhameed commented 3 years ago

Loader/classloader/DefaultInterfaceMethods/constrainedcall/constrained2_gm/constrained2_gm.dll crashes on x64 when run with MONO_ENV_OPTIONS=--full-aot.

FullAOT compilation uses these flags on x64:

MONO_ENV_OPTIONS="--aot=full,llvm,llvm-path=$MONO_PFX,mattr=sse4.2,mattr=popcnt,mattr=lzcnt,mattr=bmi,mattr=bmi2,mattr=pclmul,mattr=aes"

and these on arm64:

MONO_ENV_OPTIONS="--aot=full,llvm,llvm-path=$MONO_PFX,mattr=crc,mattr=crypto"

The output produced on CI is:

      =================================================================
      External Debugger Dump:
      =================================================================
      [New LWP 10104]
      [New LWP 10105]
      [New LWP 10106]
      [Thread debugging using libthread_db enabled]
      Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
      0x00007f18925b132a in __waitpid (pid=10109, stat_loc=0x7ffd885e37bc, options=0) at ../sysdeps/unix/sysv/linux/waitpid.c:30
      30../sysdeps/unix/sysv/linux/waitpid.c: No such file or directory.
        Id   Target Id         Frame 
      * 1    Thread 0x7f1892bd8740 (LWP 10103) "corerun" 0x00007f18925b132a in __waitpid (pid=10109, stat_loc=0x7ffd885e37bc, options=0) at ../sysdeps/unix/sysv/linux/waitpid.c:30
        2    Thread 0x7f188ebff700 (LWP 10104) "SGen worker" 0x00007f18925acad3 in futex_wait_cancelable (private=<optimized out>, expected=0, futex_word=0x7f18918385b8 <work_cond+40>) at ../sysdeps/unix/sysv/linux/futex-internal.h:88
        3    Thread 0x7f188bdeb700 (LWP 10105) "corerun" 0x00007f1891983cb9 in __GI___poll (fds=0x7f1884002d40, nfds=1, timeout=-1) at ../sysdeps/unix/sysv/linux/poll.c:29
        4    Thread 0x7f188bbea700 (LWP 10106) "Finalizer" 0x00007f18925af7c6 in futex_abstimed_wait_cancelable (private=0, abstime=0x0, expected=0, futex_word=0x7f1891829410 <finalizer_sem>) at ../sysdeps/unix/sysv/linux/futex-internal.h:205

      Thread 4 (Thread 0x7f188bbea700 (LWP 10106)):
      #0  0x00007f18925af7c6 in futex_abstimed_wait_cancelable (private=0, abstime=0x0, expected=0, futex_word=0x7f1891829410 <finalizer_sem>) at ../sysdeps/unix/sysv/linux/futex-internal.h:205
      #1  do_futex_wait (sem=sem@entry=0x7f1891829410 <finalizer_sem>, abstime=0x0) at sem_waitcommon.c:111
      #2  0x00007f18925af8b8 in __new_sem_wait_slow (sem=0x7f1891829410 <finalizer_sem>, abstime=0x0) at sem_waitcommon.c:181
      #3  0x00007f188faf11a6 in mono_os_sem_wait (sem=<optimized out>, flags=MONO_SEM_FLAGS_ALERTABLE) at /__w/1/s/src/mono/mono/mini/../utils/mono-os-semaphore.h:204
      #4  mono_coop_sem_wait (sem=<optimized out>, flags=MONO_SEM_FLAGS_ALERTABLE) at /__w/1/s/src/mono/mono/mini/../../mono/utils/mono-coop-semaphore.h:41
      #5  finalizer_thread (unused=<optimized out>) at /__w/1/s/src/mono/mono/metadata/gc.c:876
      #6  0x00007f188fac89ca in start_wrapper_internal (start_info=0x0, stack_ptr=<optimized out>) at /__w/1/s/src/mono/mono/metadata/threads.c:1201
      #7  0x00007f188fac8859 in start_wrapper (data=0x55cf84929510) at /__w/1/s/src/mono/mono/metadata/threads.c:1263
      #8  0x00007f18925a66db in start_thread (arg=0x7f188bbea700) at pthread_create.c:463
      #9  0x00007f189199071f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

      Thread 3 (Thread 0x7f188bdeb700 (LWP 10105)):
      #0  0x00007f1891983cb9 in __GI___poll (fds=0x7f1884002d40, nfds=1, timeout=-1) at ../sysdeps/unix/sysv/linux/poll.c:29
      #1  0x00007f188fd539aa in ipc_poll_fds (fds=<optimized out>, nfds=1, timeout=4294967295) at /__w/1/s/src/native/eventpipe/ds-ipc-pal-socket.c:470
      #2  ds_ipc_poll (poll_handles_data=0x7f1884002530, poll_handles_data_len=1, timeout_ms=4294967295, callback=0x7f188fd52ea0 <server_warning_callback>) at /__w/1/s/src/native/eventpipe/ds-ipc-pal-socket.c:1082
      #3  0x00007f188fd51025 in ds_ipc_stream_factory_get_next_available_stream (callback=0x7f188fd52ea0 <server_warning_callback>) at /__w/1/s/src/native/eventpipe/ds-ipc.c:395
      #4  0x00007f188fd4f889 in server_thread (data=<optimized out>) at /__w/1/s/src/native/eventpipe/ds-server.c:127
      #5  0x00007f188fd52e81 in ep_rt_thread_mono_start_func (data=0x55cf849104c0) at /__w/1/s/src/mono/mono/mini/../eventpipe/ep-rt-mono.h:1262
      #6  0x00007f18925a66db in start_thread (arg=0x7f188bdeb700) at pthread_create.c:463
      #7  0x00007f189199071f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

      Thread 2 (Thread 0x7f188ebff700 (LWP 10104)):
      #0  0x00007f18925acad3 in futex_wait_cancelable (private=<optimized out>, expected=0, futex_word=0x7f18918385b8 <work_cond+40>) at ../sysdeps/unix/sysv/linux/futex-internal.h:88
      #1  __pthread_cond_wait_common (abstime=0x0, mutex=0x7f1891838568 <lock>, cond=0x7f1891838590 <work_cond>) at pthread_cond_wait.c:502
      #2  __pthread_cond_wait (cond=0x7f1891838590 <work_cond>, mutex=0x7f1891838568 <lock>) at pthread_cond_wait.c:655
      #3  0x00007f188fb78c33 in mono_os_cond_wait (cond=<optimized out>, mutex=<optimized out>) at /__w/1/s/src/mono/mono/mini/../../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 /__w/1/s/src/mono/mono/sgen/sgen-thread-pool.c:167
      #5  thread_func (data=0x0) at /__w/1/s/src/mono/mono/sgen/sgen-thread-pool.c:198
      #6  0x00007f18925a66db in start_thread (arg=0x7f188ebff700) at pthread_create.c:463
      #7  0x00007f189199071f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

      Thread 1 (Thread 0x7f1892bd8740 (LWP 10103)):
      #0  0x00007f18925b132a in __waitpid (pid=10109, stat_loc=0x7ffd885e37bc, options=0) at ../sysdeps/unix/sysv/linux/waitpid.c:30
      #1  0x00007f188fc8c9fa in dump_native_stacktrace (signal=<optimized out>, mctx=<optimized out>) at /__w/1/s/src/mono/mono/mini/mini-posix.c:981
      #2  mono_dump_native_crash_info (signal=0x7f1891129974 "SIGABRT", mctx=0x7ffd885e42d8, info=<optimized out>) at /__w/1/s/src/mono/mono/mini/mini-posix.c:1025
      #3  0x00007f188fc2efce in mono_handle_native_crash (signal=0x7f1891129974 "SIGABRT", mctx=0x7ffd885e42d8, info=0x7ffd885e45b0) at /__w/1/s/src/mono/mono/mini/mini-exceptions.c:3382
      #4  0x00007f188fc8c04a in sigabrt_signal_handler (_dummy=6, _info=0x7ffd885e45b0, context=0x7ffd885e4480) at /__w/1/s/src/mono/mono/mini/mini-posix.c:227
      #5  <signal handler called>
      #6  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
      #7  0x00007f18918af921 in __GI_abort () at abort.c:79
      #8  0x00007f188fd052d5 in monoeg_assert_abort () at /__w/1/s/src/mono/mono/eglib/goutput.c:57
      #9  0x00007f188fb1bd93 in mono_log_write_logfile (log_domain=<optimized out>, level=<optimized out>, hdr=<optimized out>, message=0x55cf849cf1d0 "* Assertion at /__w/1/s/src/mono/mono/metadata/class.c:2006, condition `i < mcount' not met\n") at /__w/1/s/src/mono/mono/utils/mono-log-common.c:136
      #10 0x00007f188fd0573d in monoeg_g_logstr (log_domain=0x0, log_level=G_LOG_LEVEL_ERROR, msg=0x0) at /__w/1/s/src/mono/mono/eglib/goutput.c:151
      #11 monoeg_g_logv_nofree (log_domain=0x0, log_level=G_LOG_LEVEL_ERROR, format=<optimized out>, args=<optimized out>) at /__w/1/s/src/mono/mono/eglib/goutput.c:166
      #12 0x00007f188fd058a5 in monoeg_assertion_message (format=0x0) at /__w/1/s/src/mono/mono/eglib/goutput.c:207
      #13 0x00007f188fd058e7 in mono_assertion_message (file=0x7ffd885e4a10 "", line=0, condition=0x7f18918adfb7 <__GI_raise+199> "H\213\214$\b\001") at /__w/1/s/src/mono/mono/eglib/goutput.c:226
      #14 0x00007f188fa4f9a7 in mono_method_get_vtable_slot (method=0x55cf849fa910) at /__w/1/s/src/mono/mono/metadata/class.c:2006
      #15 0x00007f188fc3d30b in instantiate_info (mem_manager=0x55cf848c1830, oti=<optimized out>, context=<optimized out>, klass=0x55cf848a86e8, error=0x7ffd885e53f8) at /__w/1/s/src/mono/mono/mini/mini-generic-sharing.c:2249
      #16 0x00007f188fc396c3 in fill_runtime_generic_context (class_vtable=<optimized out>, rgctx=0x55cf848f5d70, slot=0, method_inst=<optimized out>, is_mrgctx=<optimized out>, error=<optimized out>) at /__w/1/s/src/mono/mono/mini/mini-generic-sharing.c:3036
      #17 0x00007f188fc326f7 in mono_rgctx_lazy_fetch_trampoline (regs=<optimized out>, code=<optimized out>, data=<optimized out>, tramp=0x7f18918adfb7 <__GI_raise+199> "H\213\214$\b\001") at /__w/1/s/src/mono/mono/mini/mini-trampolines.c:956
      #18 0x00007f188ca33252 in generic_trampoline_rgctx_lazy_fetch () from /datadisks/disk1/work/9878084B/p/System.Private.CoreLib.dll.so
      #19 0x00007f188b5fd183 in _Module_Check_T_INST_U_REF_T_INST () from /datadisks/disk1/work/9878084B/w/B34A0969/e/Loader/classloader/DefaultInterfaceMethods/constrainedcall/constrained2_gm/constrained2_gm.dll.so
      #20 0x000055cf848f5d70 in ?? ()
      #21 0x00007ffd885e5710 in ?? ()
      #22 0x000055cf848a87e8 in ?? ()
      #23 0x00007ffd885e59b8 in ?? ()
      #24 0x000055cf849cf080 in ?? ()
      #25 0x00007ffd885e5700 in ?? ()
      #26 0x00007f188b5fcf81 in _Module_Main () from /datadisks/disk1/work/9878084B/w/B34A0969/e/Loader/classloader/DefaultInterfaceMethods/constrainedcall/constrained2_gm/constrained2_gm.dll.so
      #27 0x0000000000000094 in ?? ()
      #28 0x00000000848f7550 in ?? ()
      #29 0x0000000000000400 in ?? ()
      #30 0x00007f188ca01b42 in wrapper_runtime_invoke_object_runtime_invoke_dynamic_intptr_intptr_intptr_intptr () from /datadisks/disk1/work/9878084B/p/System.Private.CoreLib.dll.so
      Backtrace stopped: previous frame inner to this frame (corrupt stack?)
      /datadisks/disk1/work/9878084B/w/B34A0969/e/Loader/classloader/DefaultInterfaceMethods/constrainedcall/constrained2_gm/constrained2_gm.sh: line 348: 10103 Aborted                 (core dumped) $LAUNCHER $ExePath "${CLRTestExecutionArguments[@]}"

      Return code:      1
      Raw output file:      /datadisks/disk1/work/9878084B/w/B34A0969/uploads/Reports/Loader.classloader/DefaultInterfaceMethods/constrainedcall/constrained2_gm/constrained2_gm.output.txt
      Raw output:
      BEGIN EXECUTION
      /datadisks/disk1/work/9878084B/p/corerun -p System.Reflection.Metadata.MetadataUpdater.IsSupported=false constrained2_gm.dll ''
      * Assertion at /__w/1/s/src/mono/mono/metadata/class.c:2006, condition `i < mcount' not met

      =================================================================
      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:
      =================================================================
      0x7f188fc8c7a0 - Unknown
      0x7f188fc2efce - Unknown
      0x7f188fc8c04a - Unknown
      0x7f18925b1980 - Unknown
      0x7f18918adfb7 - Unknown
      0x7f18918af921 - Unknown
      0x7f188fd052d5 - Unknown
      0x7f188fb1bd93 - Unknown
      0x7f188fd0573d - Unknown
      0x7f188fd058a5 - Unknown
      0x7f188fd058e7 - Unknown
      0x7f188fa4f9a7 - Unknown
      0x7f188fc3d30b - Unknown
      0x7f188fc396c3 - Unknown
      0x7f188fc326f7 - Unknown
      0x7f188ca33252 - Unknown

      =================================================================
      Telemetry Dumper:
      =================================================================
      Pkilling 0x139743400470272x from 0x139743517837120x
      Pkilling 0x139743402571520x from 0x139743517837120x
      Entering thread summarizer pause from 0x139743517837120x
      Finished thread summarizer pause from 0x139743517837120x.
      Failed to create breadcrumb file (null)/crash_hash_0x1c9db569
      Could not exec mono-hang-watchdog, expected on path '/__w/1/s/artifacts/obj/mono/Linux.x64.Release/out/etc/../bin/mono-hang-watchdog' (errno 2)

      Waiting for dumping threads to resume

      =================================================================
      Basic Fault Address Reporting
      =================================================================
      Memory around native instruction pointer (0x7f18918adfb7):0x7f18918adfa7  d2 4c 89 ce bf 02 00 00 00 b8 0e 00 00 00 0f 05  .L..............
      0x7f18918adfb7  48 8b 8c 24 08 01 00 00 64 48 33 0c 25 28 00 00  H..$....dH3.%(..
      0x7f18918adfc7  00 44 89 c0 75 1f 48 81 c4 18 01 00 00 c3 0f 1f  .D..u.H.........
      0x7f18918adfd7  00 48 8b 15 89 be 3a 00 f7 d8 41 b8 ff ff ff ff  .H....:...A.....

      =================================================================
      Managed Stacktrace:
      =================================================================
        at <unknown> <0xffffffff>
        at <Module>:Check <0x00032>
        at <Module>:Main <0x00030>
        at System.Object:runtime_invoke_dynamic <0x00121>
      =================================================================
ivanpovazan commented 2 years ago

Didn't have bandwidth to work on this in .NET7. Moving to milestone 8.0.0.