Bug 33938 - Debugger inspection takes forever on Mono.Cecil
Summary: Debugger inspection takes forever on Mono.Cecil
Status: RESOLVED FIXED
Alias: None
Product: Runtime
Classification: Mono
Component: Debugger ()
Version: 4.2.0 (C6)
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Zoltan Varga
URL:
Depends on:
Blocks:
 
Reported: 2015-09-14 14:31 UTC by Mikayla Hutchinson [MSFT]
Modified: 2015-11-02 22:35 UTC (History)
4 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 Mikayla Hutchinson [MSFT] 2015-09-14 14:31:23 UTC
To repro:

1. Create console project, replace Main with:

public static void Main (string [] args)
{
    var f = "/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mono/Xamarin.iOS/Xamarin.iOS.dll";
    var asm = AssemblyDefinition.ReadAssembly (f);
    Console.WriteLine (asm);
}

2. Add NuGet reference to Mono.Cecil.
3. Place breakpoint on Console.
4. Debug.
5. In the Locals pad, args and asm often never finish evaluating.
6. If asm finishes evaluating, inspect its members. They time out.
Comment 1 Mikayla Hutchinson [MSFT] 2015-09-14 14:33:09 UTC
5.5. If asm finishes evaluating in the Locals pad, hover over it. The tooltip takes about 5 seconds to evaluate it again.
Comment 2 Mikayla Hutchinson [MSFT] 2015-09-14 16:37:47 UTC
Here is a backtrace:

Thread 1 (process 83166):
#0  0x007c18f1 in ?? ()
#1  0x0008826a in mono_jit_runtime_invoke () at mini-runtime.c:2334
#2  0x0024baaf in mono_runtime_invoke (method=0x7b1f1d70, obj=0x81fc30) at object.c:2783
#3  0x0024b976 in mono_runtime_object_init (this=<value temporarily unavailable, due to optimizations>) at object.c:76
#4  0x001b38bd in mono_exception_from_name_domain (domain=<value temporarily unavailable, due to optimizations>, image=0x7c9b1800, name_space=0x2ee93a "System.Threading", name=0x30a2c4 "ThreadAbortException") at exception.c:71
#5  0x001b3d6a in mono_get_exception_thread_abort () at exception.c:41
#6  0x0021fa42 in mono_thread_execute_interruption (thread=0xa04f2038) at threads.c:4043
#7  0x00223dba in self_interrupt_thread (_unused=0x0) at threads.c:4368
#8  0x004ac389 in ?? ()
#9  0x007ee7c0 in ?? ()
#10 0x007ee25c in ?? ()
#11 0x007ec494 in ?? ()
#12 0x007eb8d4 in ?? ()
#13 0x007eb7b8 in ?? ()
#14 0x007d6e70 in ?? ()
#15 0x007d6de0 in ?? ()
#16 0x007d6c84 in ?? ()
#17 0x007d6c2a in ?? ()
#18 0x007d6af8 in ?? ()
#19 0x007d6a78 in ?? ()
#20 0x007d68da in ?? ()
#21 0x007d6794 in ?? ()
#22 0x007d6718 in ?? ()
#23 0x007d669c in ?? ()
#24 0x007d605c in ?? ()
#25 0x007d5f8c in ?? ()
#26 0x007d550c in ?? ()
#27 0x007d4214 in ?? ()
#28 0x007d3f1c in ?? ()
#29 0x007d3ea0 in ?? ()
#30 0x007d3e58 in ?? ()
#31 0x007d3d30 in ?? ()
#32 0x007d3b78 in ?? ()
#33 0x007cb8b8 in ?? ()
#34 0x007cb610 in ?? ()
#35 0x007cb3e8 in ?? ()
#36 0x007cb4b6 in ?? ()
#37 0x0008826a in mono_jit_runtime_invoke () at mini-runtime.c:2334
#38 0x0024baaf in mono_runtime_invoke (method=0x7b1b6e08, obj=0x803900) at object.c:2783
#39 0x00159848 in do_invoke_method (tls=<value temporarily unavailable, due to optimizations>, buf=<value temporarily unavailable, due to optimizations>, invoke=<value temporarily unavailable, due to optimizations>, p=0x7c04bdbd "", endp=<value temporarily unavailable, due to optimizations>) at debugger-agent.c:6589
#40 0x00158d0c in invoke_method [inlined] () at :6707
#41 0x00158d0c in suspend_current () at debugger-agent.c:2934
#42 0x00155772 in process_event (event=2689540152, arg=0x12068, il_offset=<value temporarily unavailable, due to optimizations>, ctx=<value temporarily unavailable, due to optimizations>, events=<value temporarily unavailable, due to optimizations>, suspend_policy=Cannot access memory at address 0x0
) at debugger-agent.c:3749
#43 0x00156c34 in process_breakpoint_inner (tls=<value temporarily unavailable, due to optimizations>) at debugger-agent.c:4671
#44 0x0015c98a in process_signal_event (func=<value temporarily unavailable, due to optimizations>) at debugger-agent.c:4689
#45 0x001542c7 in process_breakpoint () at debugger-agent.c:4701
#46 0x006ab204 in ?? ()
#47 0x006ab3c8 in ?? ()
#48 0x0008826a in mono_jit_runtime_invoke () at mini-runtime.c:2334
#49 0x0024baaf in mono_runtime_invoke (method=0x7c9b16c8, obj=0x0) at object.c:2783
#50 0x00251801 in mono_runtime_exec_main (method=0x7c9b16c8, args=<value temporarily unavailable, due to optimizations>, exc=0x0) at object.c:4040
#51 0x002515ba in mono_runtime_run_main () at object.c:3666
#52 0x001003ed in mono_jit_exec (domain=0x7c1073a0, assembly=0x7c121f80, argc=73832, argv=0xa04f2038) at driver.c:1004
#53 0x00102700 in mono_main (argc=<value temporarily unavailable, due to optimizations>, argv=<value temporarily unavailable, due to optimizations>) at driver.c:1063
#54 0x0007ab80 in main (argc=<value temporarily unavailable, due to optimizations>, argv=<value temporarily unavailable, due to optimizations>) at main.c:94
Comment 3 Mikayla Hutchinson [MSFT] 2015-09-14 16:40:01 UTC
It looks like a race in the runtime. Either it finishes evaluating, or it gets stuck forever.
Comment 4 Mikayla Hutchinson [MSFT] 2015-09-14 16:43:50 UTC
It's reproducible maybe 1 in 5 times on my machine, but the stack trace is always the same.
Comment 5 David Karlaš 2015-09-15 03:46:37 UTC
This is also happening with Mono 4.0.4 and XS 5.9.6(both stable channel)(just saying it's not recent regression).

I'm seeing two problems here.

1st is slow execution of CMD_VM_INVOKE_METHOD.
Problem is that invokes from IDE(via SDB)(command CMD_VM_INVOKE_METHOD) are for some reason executed by stepping instead of normal execution this is visible by doing --debugger-agent=loglevel=10 and when hovering over "asm" variable. Application Output will have thousands of lines repeating this two:
[0xa07671d4] Ignored during single threaded invoke.
[0xa07671d4] Received single step event for suspending.

2nd problem I think is some kind of hang when thread executing CMD_VM_INVOKE_METHOD is CMD_VM_ABORT_INVOKEd(thread.Abort()). CMD_VM_ABORT_INVOKE is called by IDE when CMD_VM_INVOKE_METHOD timeout(default 5sec).

I can't reproduce 2nd problem... Michael, maybe you can try changing timeout setting in XS Settings  and see if it's affecting 2nd problem...
Comment 6 David Karlaš 2015-10-31 10:28:38 UTC
Problem 1 is fixed by https://github.com/mono/mono/commit/3be72d90bf034623b28fff26cf9c9961337367bc

Problem 2 is Bug 35099, which is not reproducible on Master

I guess this can be closed :)
Comment 7 Zoltan Varga 2015-11-02 22:35:33 UTC
-> FIXED.