Bug 43122 - Assert when using ppdb with vscode
Summary: Assert when using ppdb with vscode
Status: RESOLVED FIXED
Alias: None
Product: Runtime
Classification: Mono
Component: Debugger ()
Version: master
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Zoltan Varga
URL:
Depends on:
Blocks:
 
Reported: 2016-08-06 12:01 UTC by Dylan Borg
Modified: 2016-08-08 07:55 UTC (History)
3 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Dylan Borg 2016-08-06 12:01:00 UTC
I recently moved my compiler to use managed.reflection which uses ppdb file for debug output. I could debug without issues when it used to output mdb files. I can also run fine if no debugger attaches to the mono runtime or when using --debug without attaching a debugger.

* Assertion at metadata.c:1028, condition `idx >= 0' not met

Stacktrace:

  at <unknown> <0xffffffff>
  at hellotasks.Program.ReadAsync () [0x0001f] in /mnt/ssd/vnext/hellotasks/hellotasks.dyl:160
  at hellotasks.Program.Main () [0x00010] in /mnt/ssd/vnext/hellotasks/hellotasks.dyl:203
  at (wrapper runtime-invoke) object.runtime_invoke_void (object,intptr,intptr,intptr) <IL 0x0004d, 0x002cd>

Native stacktrace:

	mono() [0x4b32cf]
	/lib/x86_64-linux-gnu/libpthread.so.0(+0x113d0) [0x7f9c095bf3d0]
	/lib/x86_64-linux-gnu/libc.so.6(gsignal+0x38) [0x7f9c09004418]
	/lib/x86_64-linux-gnu/libc.so.6(abort+0x16a) [0x7f9c0900601a]
	mono() [0x67169b]
	mono() [0x671435]
	mono() [0x6715e9]
	mono(mono_metadata_decode_row+0xfb) [0x57a6fb]
	mono() [0x603e29]
	mono() [0x6047b0]
	mono() [0x4d1f3a]
	mono() [0x4ddfd0]
	mono() [0x4e0e51]
	mono() [0x59b5d7]
	mono() [0x515e71]
	mono() [0x425e21]
	mono() [0x4b4c38]
	mono() [0x4b5382]
	[0x40a9128c]

Debug info from gdb:

[New LWP 2615]
[New LWP 2617]
[New LWP 2618]
warning: File "/usr/local/bin/mono-sgen-gdb.py" auto-loading has been declined by your `auto-load safe-path' set to "$debugdir:$datadir/auto-load".
To enable execution of this file, add
	add-auto-load-safe-path /usr/local/bin/mono-sgen-gdb.py
line to your configuration file "/home/dylan/.gdbinit".
To completely disable this security protection, add
	set auto-load safe-path /
line to your configuration file "/home/dylan/.gdbinit".
For more information about this security protection, see the
"Auto-loading safe path" section in the GDB manual.  E.g., run from the shell:
	info "(gdb)Auto-loading safe path"
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
0x00007f9c095befbb in __waitpid (pid=pid@entry=2789, stat_loc=stat_loc@entry=0x7ffcea07597c, options=options@entry=0) at ../sysdeps/unix/sysv/linux/waitpid.c:29
29	../sysdeps/unix/sysv/linux/waitpid.c: No such file or directory.
  Id   Target Id         Frame 
* 1    Thread 0x7f9c0a0ce780 (LWP 2614) "Main" 0x00007f9c095befbb in __waitpid (pid=pid@entry=2789, stat_loc=stat_loc@entry=0x7ffcea07597c, options=options@entry=0) at ../sysdeps/unix/sysv/linux/waitpid.c:29
  2    Thread 0x7f9c083ff700 (LWP 2615) "SGen worker" pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
  3    Thread 0x7f9c06b7b700 (LWP 2617) "Finalizer" 0x00007f9c095bd867 in futex_abstimed_wait_cancelable (private=0, abstime=0x0, expected=0, futex_word=0x9a13e0 <finalizer_sem>) at ../sysdeps/unix/sysv/linux/futex-internal.h:205
  4    Thread 0x7f9c0697a700 (LWP 2618) "Debugger agent" 0x00007f9c095be8bf in __libc_recv (fd=fd@entry=4, buf=buf@entry=0x7f9c06979d20, n=n@entry=11, flags=flags@entry=0) at ../sysdeps/unix/sysv/linux/x86_64/recv.c:28

Thread 4 (Thread 0x7f9c0697a700 (LWP 2618)):
#0  0x00007f9c095be8bf in __libc_recv (fd=fd@entry=4, buf=buf@entry=0x7f9c06979d20, n=n@entry=11, flags=flags@entry=0) at ../sysdeps/unix/sysv/linux/x86_64/recv.c:28
#1  0x00000000004e1825 in recv (__flags=0, __n=11, __buf=0x7f9c06979d20, __fd=4) at /usr/include/x86_64-linux-gnu/bits/socket2.h:44
#2  socket_transport_recv (buf=0x7f9c06979d20, len=11) at debugger-agent.c:1130
#3  0x00000000004de0fd in transport_recv (len=11, buf=0x7f9c06979d20) at debugger-agent.c:1536
#4  debugger_thread (arg=<optimised out>) at debugger-agent.c:9849
#5  0x0000000000665f1f in inner_start_thread (arg=<optimised out>) at mono-threads-posix.c:156
#6  0x00007f9c095b56fa in start_thread (arg=0x7f9c0697a700) at pthread_create.c:333
#7  0x00007f9c090d5b5d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109

Thread 3 (Thread 0x7f9c06b7b700 (LWP 2617)):
#0  0x00007f9c095bd867 in futex_abstimed_wait_cancelable (private=0, abstime=0x0, expected=0, futex_word=0x9a13e0 <finalizer_sem>) at ../sysdeps/unix/sysv/linux/futex-internal.h:205
#1  do_futex_wait (sem=sem@entry=0x9a13e0 <finalizer_sem>, abstime=0x0) at sem_waitcommon.c:111
#2  0x00007f9c095bd914 in __new_sem_wait_slow (sem=0x9a13e0 <finalizer_sem>, abstime=0x0) at sem_waitcommon.c:181
#3  0x00007f9c095bd9ba in __new_sem_wait (sem=sem@entry=0x9a13e0 <finalizer_sem>) at sem_wait.c:29
#4  0x00000000005cdb4f in mono_os_sem_wait (flags=MONO_SEM_FLAGS_ALERTABLE, sem=0x9a13e0 <finalizer_sem>) at ../../mono/utils/mono-os-semaphore.h:209
#5  mono_coop_sem_wait (flags=MONO_SEM_FLAGS_ALERTABLE, sem=0x9a13e0 <finalizer_sem>) at ../../mono/utils/mono-coop-semaphore.h:40
#6  finalizer_thread (unused=unused@entry=0x0) at gc.c:894
#7  0x00000000005a9adc in start_wrapper_internal (data=<optimised out>) at threads.c:753
#8  start_wrapper (data=<optimised out>) at threads.c:815
#9  0x0000000000665f1f in inner_start_thread (arg=<optimised out>) at mono-threads-posix.c:156
#10 0x00007f9c095b56fa in start_thread (arg=0x7f9c06b7b700) at pthread_create.c:333
#11 0x00007f9c090d5b5d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109

Thread 2 (Thread 0x7f9c083ff700 (LWP 2615)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
#1  0x00000000006399df in mono_os_cond_wait (mutex=0x9b0800 <lock>, cond=0x9b07c0 <work_cond>) at ../../mono/utils/mono-os-mutex.h:150
#2  thread_func (thread_data=0x0) at sgen-thread-pool.c:110
#3  0x00007f9c095b56fa in start_thread (arg=0x7f9c083ff700) at pthread_create.c:333
#4  0x00007f9c090d5b5d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109

Thread 1 (Thread 0x7f9c0a0ce780 (LWP 2614)):
#0  0x00007f9c095befbb in __waitpid (pid=pid@entry=2789, stat_loc=stat_loc@entry=0x7ffcea07597c, options=options@entry=0) at ../sysdeps/unix/sysv/linux/waitpid.c:29
#1  0x00000000004b33a6 in mono_handle_native_sigsegv (signal=<optimised out>, ctx=<optimised out>, info=<optimised out>) at mini-exceptions.c:2424
#2  <signal handler called>
#3  0x00007f9c09004418 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:54
#4  0x00007f9c0900601a in __GI_abort () at abort.c:89
#5  0x000000000067169b in monoeg_log_default_handler (log_domain=0x0, log_level=G_LOG_LEVEL_ERROR, message=0x1edbd30 "* Assertion at metadata.c:1028, condition `idx >= 0' not met\n", unused_data=0x0) at goutput.c:231
#6  0x0000000000671435 in monoeg_g_logv (log_domain=0x0, log_level=G_LOG_LEVEL_ERROR, format=0x67d988 "* Assertion at %s:%d, condition `%s' not met\n", args=0x7ffcea076910) at goutput.c:111
#7  0x00000000006715e9 in monoeg_assertion_message (format=0x67d988 "* Assertion at %s:%d, condition `%s' not met\n") at goutput.c:131
#8  0x000000000057a6fb in mono_metadata_decode_row (t=t@entry=0x1cfd440, idx=idx@entry=-1, res=res@entry=0x7ffcea076a20, res_size=res_size@entry=4) at metadata.c:1028
#9  0x0000000000603e29 in get_docinfo (image=image@entry=0x1cfd070, docidx=<optimised out>, ppdb=0x1c8f840) at debug-mono-ppdb.c:219
#10 0x00000000006047b0 in mono_ppdb_get_seq_points (minfo=<optimised out>, source_file=source_file@entry=0x7ffcea076ba8, source_file_list=source_file_list@entry=0x7ffcea076bb0, source_files=source_files@entry=0x0, seq_points=seq_points@entry=0x0, n_seq_points=n_seq_points@entry=0x0) at debug-mono-ppdb.c:433
#11 0x00000000005915b0 in mono_debug_get_seq_points (minfo=<optimised out>, source_file=source_file@entry=0x7ffcea076ba8, source_file_list=source_file_list@entry=0x7ffcea076bb0, source_files=source_files@entry=0x0, seq_points=seq_points@entry=0x0, n_seq_points=n_seq_points@entry=0x0) at mono-debug.c:994
#12 0x00000000004d1f3a in create_event_list (event=event@entry=EVENT_KIND_TYPE_LOAD, reqs=0x1c6d850, reqs@entry=0x0, ji=ji@entry=0x0, ei=ei@entry=0x7ffcea076c10, suspend_policy=suspend_policy@entry=0x7ffcea076c0c) at debugger-agent.c:3452
#13 0x00000000004ddfd0 in process_profiler_event (event=event@entry=EVENT_KIND_TYPE_LOAD, arg=arg@entry=0x7f9bf800d168) at debugger-agent.c:3783
#14 0x00000000004e0e51 in emit_type_load (user_data=0x0, value=0x7f9bf800d168, key=0x7f9bf800d168) at debugger-agent.c:3273
#15 send_type_load (klass=0x7f9bf800d168) at debugger-agent.c:4007
#16 jit_end (prof=<optimised out>, method=0x7f9bf8012a98, jinfo=0x1edeab8, result=0) at debugger-agent.c:4055
#17 0x000000000059b5d7 in mono_profiler_method_end_jit (method=method@entry=0x7f9bf8012a98, jinfo=jinfo@entry=0x1edeab8, result=result@entry=0) at profiler.c:484
#18 0x0000000000515e71 in mono_jit_compile_method_inner (method=method@entry=0x7f9bf8012a98, target_domain=target_domain@entry=0x1c87330, opt=opt@entry=370239999, error=error@entry=0x7ffcea076fb0) at mini.c:4402
#19 0x0000000000425e21 in mono_jit_compile_method_with_opt (method=method@entry=0x7f9bf8012a98, opt=370239999, error=error@entry=0x7ffcea076fb0) at mini-runtime.c:1914
#20 0x000000000042672a in mono_jit_compile_method (method=method@entry=0x7f9bf8012a98, error=error@entry=0x7ffcea076fb0) at mini-runtime.c:1958
#21 0x00000000004b4c38 in common_call_trampoline (regs=regs@entry=0x7ffcea077088, code=code@entry=0x404ec560 "A\273\001", m=m@entry=0x7f9bf8012a98, vt=vt@entry=0x0, vtable_slot=<optimised out>, vtable_slot@entry=0x0, error=error@entry=0x7ffcea076fb0) at mini-trampolines.c:701
#22 0x00000000004b5382 in mono_magic_trampoline (regs=0x7ffcea077088, code=0x404ec560 "A\273\001", arg=0x7f9bf8012a98, tramp=<optimised out>) at mini-trampolines.c:831
#23 0x0000000040a9128c in ?? ()
#24 0x0000000000000000 in ?? ()

=================================================================
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.
=================================================================
Comment 1 Dylan Borg 2016-08-06 12:01:56 UTC
As a side note, this application includes async code and thus uses threading.
Comment 2 Dylan Borg 2016-08-06 12:03:51 UTC
After testing with a single threaded app I can observe the same symptoms.
Comment 3 Dylan Borg 2016-08-08 07:55:44 UTC
The bug was in Managed.Reflection.