Bug 53890 - Regression: Native crash while running tests with xunit with mono 2017-02 branch, works with 4.8.0.520
Summary: Regression: Native crash while running tests with xunit with mono 2017-02 bra...
Status: VERIFIED FIXED
Alias: None
Product: Runtime
Classification: Mono
Component: General (show other bugs)
Version: unspecified
Hardware: PC Mac OS
: --- blocker
Target Milestone: 15.2
Assignee: Aleksey Kliger
URL:
Depends on:
Blocks: 55341
  Show dependency tree
 
Reported: 2017-03-24 09:09 UTC by Ankit Jain
Modified: 2017-05-03 14:38 UTC (History)
7 users (show)

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


Attachments
log-4.9.3.63 (91.26 KB, text/plain)
2017-03-24 09:09 UTC, Ankit Jain
Details
log-4.9.3.63 (89.67 KB, text/plain)
2017-03-24 09:17 UTC, Ankit Jain
Details


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:
VERIFIED FIXED

Description Ankit Jain 2017-03-24 09:09:29 UTC
Created attachment 20781 [details]
log-4.9.3.63

To reproduce:

$ git clone git@github.com:mono/msbuild.git
# xplat-master branch

$ ./cibuild.sh --scope Test --host Mono --target Mono

The above crashes while trying to run tests with xunit:

(partial trace here, full output log attached):
========

    at (wrapper managed-to-native) System.Runtime.Remoting.Proxies.RealProxy.InternalGetProxyType (object) <0x00012>
    at System.Runtime.Remoting.Proxies.RealProxy.GetProxiedType () [0x00027] in <6ee31efbdbd54ef9b1eb26def1af9a98>:0
    at System.Runtime.Remoting.Proxies.RemotingProxy.CanCastTo (System.Type,object) [0x00059] in <6ee31efbdbd54ef9b1eb26def1af9a98>:0
    at (wrapper runtime-invoke) <Module>.runtime_invoke_bool__this___object_object (object,intptr,intptr,intptr) [0x00059] in <6ee31efbdbd54ef9b1eb26def1af9a98>:0

...

      frame #3: 0x002226b9 mono`mono_arch_handle_altstack_exception(sigctx=<unavailable>, siginfo=<unavailable>, fault_addr=<unavailable>, stack_ovf=0) + 169 at exceptions-x86.c:1115 [opt]
      frame #4: 0x001058d2 mono`mono_sigsegv_signal_handler(_dummy=<unavailable>, _info=<unavailable>, context=<unavailable>) + 482 at mini-runtime.c:2857 [opt]
      frame #5: 0x9f98eebb libsystem_platform.dylib`_sigtramp + 43
      frame #6: 0x00248433 mono`mono_class_from_mono_type(type=0x0000006c) + 19 at class.c:6319 [opt]
      frame #7: 0x00345d93 mono`mono_type_get_object_checked(domain=0x78fb4090, type=0x0000006c, error=<unavailable>) + 51 at reflection.c:451 [opt]
      frame #8: 0x002786dc mono`ves_icall_Remoting_RealProxy_InternalGetProxyType(tp=0x00959580) + 44 at icall.c:6391 [opt]

==========

Also, complains:

EXEC : error : (i386) /Library/Frameworks/Mono.framework/Versions/4.9.3/lib/mono/4.5/mscorlib.dll.dylib empty dSYM file detected, dSYM was created with an executable with no debug info. [/Users/ankit/dev/msbuild/src/Framework.UnitTests/Microsoft.Build.Framework.UnitTests.csproj]

This is with mono 4.9.3.63 from the 2017-02 branch, built on wrench few hours back (06060e29).

Full output log is attached.

This works fine with mono 4.8.0.520 .

I was getting the same result with a recent 4.9.4.x, but I didn't try the latest from master.
Comment 1 Ankit Jain 2017-03-24 09:17:23 UTC
Created attachment 20782 [details]
log-4.9.3.63
Comment 2 Ankit Jain 2017-03-24 17:33:11 UTC
I'm getting the same thing with 5.0.0.9
Comment 3 Aleksey Kliger 2017-03-24 21:17:15 UTC
So somehow ves_icall_Remoting_RealProxy_InternalGetProxyType is being called with a System.String as the argument.  Some printf debugging (https://gist.github.com/lambdageek/147b5a92be3febc8be2dfa08052255f4) shows

    $ ../mono/mono/mini/mono /Users/alekseyk/work/msbuild/packages/xunit.runn
er.console/2.1.0/tools/xunit.console.x86.exe /Users/alekseyk/work/msbuild/bin/D
ebug-MONO/OSX_Deployment_Test/Microsoft.Build.Engine.OM.UnitTests.dll  -notrait
 category=nonosxtests -notrait category=non-mono-tests -notrait category=mono-o
sx-failing -noshadow -parallel none -xml /Users/alekseyk/work/msbuild/bin/Debug
-MONO/OSX_Deployment_Test/Microsoft.Build.Engine.OM.UnitTests.dll_TestResults.x
ml -html /Users/alekseyk/work/msbuild/bin/Debug-MONO/OSX_Deployment_Test/Micros
oft.Build.Engine.OM.UnitTests.dll_TestResults.html
    xUnit.net Console Runner (64-bit .NET 4.0.30319.42000)
    tp class is System.String
    tp is 0x102dec8e0
    remote_class is 0x62006d00650073

(and then it crashes trying to print the tp->remote_class->proxy_class).

So someone is creating a RealProxy instance with __objTP set to a string instead of a proxy.
Comment 4 Aleksey Kliger 2017-03-24 22:45:34 UTC
Ugh.  mono_object_handle_isinst_mbyref calls mono_runtime_invoke_checked (..., rp, ..., ...) when it should be mono_runtime_invoked_checked (..., MONO_HANDLE_RAW (rp), ..., ...)

Easy fix, but now I'm worried that I made the same mistake elsewhere.
Comment 5 Aleksey Kliger 2017-03-24 23:20:56 UTC
Andi,
  Reassigning to you since I'm out of time on babysitting the Jenkins builds.

PR against 2017-02 https://github.com/mono/mono/pull/4592
  (msbbuild passes unit tests on my machine with this PR applies)
PR against master https://github.com/mono/mono/pull/4594
Comment 6 Andi McClure 2017-03-27 19:23:40 UTC
Merged to 2017-02 as of df9df437aee0d67a64744db1c5a28ca805b0644d
Comment 7 Andi McClure 2017-04-10 17:06:12 UTC
Reopening and sending to Aleksey because we want to add an automated test.
Comment 8 Andi McClure 2017-04-18 18:08:54 UTC
…correction: Closing as fixed and opening #55341 to track the need for a test.
Comment 9 Aman Dharwal 2017-04-21 05:57:11 UTC
@Andi McClure
as per #comment 8 , Could you please mark this bug as verified/close. There is Bug#55341 has been created and it is New Status.