Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[mono2018-02] Unittest fail to launch on 32 bit device #3826

Closed
GouriKumari opened this issue Mar 28, 2018 · 9 comments
Closed

[mono2018-02] Unittest fail to launch on 32 bit device #3826

GouriKumari opened this issue Mar 28, 2018 · 9 comments
Labels
bug If an issue is a bug or a pull request a bug fix iOS Issues affecting Xamarin.iOS
Milestone

Comments

@GouriKumari
Copy link
Contributor

GouriKumari commented Mar 28, 2018

Steps to Reproduce

  1. Install system with XI from mono-2018-02 branch. Update xamarin-macios with the same sample revision.
  2. Execute any unittest on 32 bit device

Expected Behavior

App launches and runs successfully

Actual Behavior

App launches with a black screen but fails with a stacktrace

Environment

Xamarin.iOS
Version: 11.11.0.155 (Visual Studio Community)
Hash: d458533

Build Logs

Build log: https://gist.github.com/GouriKumari/b1743a8dca173cf3db14cfc2e22f2369
Stacktrace:
monotouch-test: http://xqa.blob.core.windows.net/gist/report-627b3c1e82c44a6882e7d3c31da80d9f.txt
linksdk test: http://xqa.blob.core.windows.net/gist/report-2739bbe2fc744e75a436a2a44dd5b7d7.txt
linkalltest: http://xqa.blob.core.windows.net/gist/report-8d7550e89664400b83604c729b6eb063.txt
mini

@spouliot
Copy link
Contributor

@GouriKumari can you attach the crash reports please ? thanks!

@GouriKumari
Copy link
Contributor Author

@spouliot
Copy link
Contributor

Exception Codes: 0x000000008badf00d
Exception Note:  SIMULATED (this is NOT a crash)
...
com.xamarin.mini failed to scene-create after 17.83s (launch took 2.17s of total time limit 20.00s)

means it's the watchdog that killed it

but something crashed

10  mini                          	0x006499f0 monoeg_g_log + 6232560 (goutput.c:116)
11  mini                          	0x00571216 mono_handle_native_crash + 5345814 (mini-exceptions.c:2694)
12  mini                          	0x0057a50c mono_sigsegv_signal_handler + 5383436 (mini-runtime.c:3143)
13  libsystem_platform.dylib      	0x23fce076 _sigtramp + 42

and was trying to write in the device logs

@GouriKumari can you attach the device logs too ? thanks!

@luhenry
Copy link
Contributor

luhenry commented Mar 29, 2018

/cc @lewurm

@therealjohn therealjohn added the need-info Waiting for more information before the bug can be investigated label Mar 29, 2018
@therealjohn therealjohn added this to the Future milestone Mar 29, 2018
@lewurm
Copy link
Contributor

lewurm commented Mar 29, 2018

I can reproduce this:

Process 270 stopped
* thread #1, name = 'tid_403', queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=EXC_ARM_DA_ALIGN, address=0x16933124)
    frame #0: 0x0066f4b2 mini`mono_atomic_cas_i64(dest=0x16933124, exch=<unavailable>, comp=<unavailable>) at atomic.c:519 [opt]
   516 	gint64
   517 	mono_atomic_cas_i64(volatile gint64 *dest, gint64 exch, gint64 comp)
   518 	{
-> 519 		return  __sync_val_compare_and_swap (dest, comp, exch);
   520 	}
   521
   522 	#elif defined (TARGET_ANDROID)
Target 0: (mini) stopped.
(lldb) bt
* thread #1, name = 'tid_403', queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=EXC_ARM_DA_ALIGN, address=0x16933124)
  * frame #0: 0x0066f4b2 mini`mono_atomic_cas_i64(dest=0x16933124, exch=<unavailable>, comp=<unavailable>) at atomic.c:519 [opt]
    frame #1: 0x006292ea mini`ves_icall_System_Threading_ThreadPool_NotifyWorkItemQueued [inlined] mono_atomic_inc_i64 at atomic.h:397 [opt]
    frame #2: 0x006292d6 mini`ves_icall_System_Threading_ThreadPool_NotifyWorkItemQueued at threadpool.c:743 [opt]
    frame #3: 0x00317170 mini`wrapper_managed_to_native_System_Threading_ThreadPool_NotifyWorkItemQueued + 64
    frame #4: 0x00313f28 mini`System_Threading_ThreadPoolWorkQueue_Enqueue_System_Threading_IThreadPoolWorkItem_bool + 536
    frame #5: 0x00316aa0 mini`System_Threading_ThreadPool_QueueUserWorkItemHelper_System_Threading_WaitCallback_object_System_Threading_StackCrawlMark__bool + 312
    frame #6: 0x0031690c mini`System_Threading_ThreadPool_QueueUserWorkItem_System_Threading_WaitCallback + 56
    frame #7: 0x00485d78 mini`MonoTouch_NUnit_UI_TouchRunner_GetViewController(this=0x02586cf0) at TouchRunner.cs:532
    frame #8: 0x001525f0 mini`mini_AppDelegate_FinishedLaunching_UIKit_UIApplication_Foundation_NSDictionary(this=0x025843f8, app=0x02585b08, options=0x00000000) at AppDelegate.cs:116
    frame #9: 0x00397ea8 mini`wrapper_runtime_invoke_object_runtime_invoke_dynamic_intptr_intptr_intptr_intptr + 232
    frame #10: 0x005b4f12 mini`mono_jit_runtime_invoke(method=<unavailable>, obj=<unavailable>, params=<unavailable>, exc=0x00000000, error=<unavailable>) at mini-runtime.c:2782 [opt]
    frame #11: 0x0060c732 mini`do_runtime_invoke(method=<unavailable>, obj=<unavailable>, params=0x009ac770, exc=0x00000000, error=<unavailable>) at object.c:2922 [opt]
    frame #12: 0x0060c6cc mini`mono_runtime_invoke [inlined] mono_runtime_invoke_checked(method=<unavailable>, obj=0x025843f8, params=0x009ac770, error=0x00000000) at object.c:3075 [opt]
    frame #13: 0x0060c69e mini`mono_runtime_invoke(method=0x16976a68, obj=0x025843f8, params=0x009ac770, exc=<unavailable>) at object.c:2976 [opt]
    frame #14: 0x00095b80 mini`native_to_managed_trampoline_4(self=0x15e17c50, _cmd="application:didFinishLaunchingWithOptions:", managed_method_ptr=0x007890ac, p0=0x15d37e30, p1=0x00000000, token_ref=363008) at registrar.m:158
    frame #15: 0x00095980 mini`::-[AppDelegate application:didFinishLaunchingWithOptions:](self=0x15e17c50, _cmd="application:didFinishLaunchingWithOptions:", p0=0x15d37e30, p1=0x00000000) at registrar.m:2737
    frame #16: 0x203e55c4 UIKit`-[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 376
    frame #17: 0x205e6a4a UIKit`-[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 3706
    frame #18: 0x205ebc1c UIKit`-[UIApplication _runWithMainScene:transitionContext:completion:] + 1640
    frame #19: 0x205fe7c4 UIKit`__84-[UIApplication _handleApplicationActivationWithScene:transitionContext:completion:]_block_invoke.3149 + 40
    frame #20: 0x205e935a UIKit`-[UIApplication workspaceDidEndTransaction:] + 142
    frame #21: 0x1ca24c12 FrontBoardServices`__FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 18
    frame #22: 0x1ca24acc FrontBoardServices`-[FBSSerialQueue _performNext] + 220
    frame #23: 0x1ca24db6 FrontBoardServices`-[FBSSerialQueue _performNextFromRunLoopSource] + 44
    frame #24: 0x1b0fffdc CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 12
    frame #25: 0x1b0ffb04 CoreFoundation`__CFRunLoopDoSources0 + 424
    frame #26: 0x1b0fdf50 CoreFoundation`__CFRunLoopRun + 1160
    frame #27: 0x1b0511ae CoreFoundation`CFRunLoopRunSpecific + 470
    frame #28: 0x1b050fd0 CoreFoundation`CFRunLoopRunInMode + 104
    frame #29: 0x203dee2c UIKit`-[UIApplication _run] + 660
    frame #30: 0x203d9a52 UIKit`UIApplicationMain + 150
    frame #31: 0x00514d40 mini`wrapper_managed_to_native_UIKit_UIApplication_UIApplicationMain_int_string___intptr_intptr(param0=6, param1=0x02580a08, param2=0, param3=366169456) + 288
    frame #32: 0x004e1ab4 mini`UIKit_UIApplication_Main_string___intptr_intptr(args=0x02580a08, principal=0, delegate=366169456) at UIApplication.cs:79
    frame #33: 0x004e1a74 mini`UIKit_UIApplication_Main_string___string_string(args=0x02580a08, principalClassName=0x009adc4c, delegateClassName=0x030d4148) at UIApplication.cs:63
    frame #34: 0x001513a4 mini`mini_Application_Main_string__(args=0x02580a08) at Main.cs:17
    frame #35: 0x00397ea8 mini`wrapper_runtime_invoke_object_runtime_invoke_dynamic_intptr_intptr_intptr_intptr + 232
    frame #36: 0x005b4f12 mini`mono_jit_runtime_invoke(method=<unavailable>, obj=<unavailable>, params=<unavailable>, exc=0x00000000, error=<unavailable>) at mini-runtime.c:2782 [opt]
    frame #37: 0x0060c732 mini`do_runtime_invoke(method=<unavailable>, obj=<unavailable>, params=0x009adfec, exc=0x00000000, error=<unavailable>) at object.c:2922 [opt]
    frame #38: 0x0060e9b0 mini`do_exec_main_checked [inlined] mono_runtime_invoke_checked(method=<unavailable>, obj=<unavailable>, error=0x009ae00c) at object.c:3075 [opt]
    frame #39: 0x0060e980 mini`do_exec_main_checked(method=0x161300b8, args=<unavailable>, error=0x009ae00c) at object.c:4819 [opt]
    frame #40: 0x005a164a mini`mono_jit_exec(domain=<unavailable>, assembly=<unavailable>, argc=7, argv=0x009ae054) at driver.g.c:1210 [opt]
    frame #41: 0x006998d8 mini`::xamarin_main(argc=9, argv=0x009ae984, launch_mode=XamarinLaunchModeApp) at monotouch-main.m:485
    frame #42: 0x0009e9b8 mini`main(argc=9, argv=0

lewurm added a commit to lewurm/mono that referenced this issue Mar 29, 2018
clang fails to properly align 64bit members of the `MonoPerfCounters` struct on
32bit builds:

```
* thread #1, name = 'tid_403', queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=EXC_ARM_DA_ALIGN, address=0x16933124)
    frame #0: 0x0066f4b2 mini`mono_atomic_cas_i64(dest=0x16933124, exch=<unavailable>, comp=<unavailable>) at atomic.c:519 [opt]
   516 	gint64
   517 	mono_atomic_cas_i64(volatile gint64 *dest, gint64 exch, gint64 comp)
   518 	{
-> 519 		return  __sync_val_compare_and_swap (dest, comp, exch);
   520 	}
   521
   522 	#elif defined (TARGET_ANDROID)
(lldb) up
frame #1: 0x006292ea mini`ves_icall_System_Threading_ThreadPool_NotifyWorkItemQueued [inlined] mono_atomic_inc_i64 at atomic.h:397 [opt]
   394 		do {
   395 			get = *val;
   396 			set = get + 1;
-> 397 		} while (mono_atomic_cas_i64 (val, set, get) != get);
   398 		return set;
   399 	}
   400
(lldb) up
frame #2: 0x006292d6 mini`ves_icall_System_Threading_ThreadPool_NotifyWorkItemQueued at threadpool.c:743 [opt]
   740 	ves_icall_System_Threading_ThreadPool_NotifyWorkItemQueued (void)
   741 	{
   742 	#ifndef DISABLE_PERFCOUNTERS
-> 743 		mono_atomic_inc_i64 (&mono_perfcounters->threadpool_workitems);
   744 	#endif
   745 	}
   746
```

Note that the member `threadpool_workitems` is on an unnatural alignment
(`0x16933124`) regarding to its type `gint64`.

related xamarin/xamarin-macios#3826
@spouliot spouliot added bug If an issue is a bug or a pull request a bug fix iOS Issues affecting Xamarin.iOS and removed need-info Waiting for more information before the bug can be investigated labels Mar 29, 2018
lewurm added a commit to mono/mono that referenced this issue Mar 29, 2018
clang fails to properly align 64bit members of the `MonoPerfCounters` struct on
32bit builds:

```
* thread #1, name = 'tid_403', queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=EXC_ARM_DA_ALIGN, address=0x16933124)
    frame #0: 0x0066f4b2 mini`mono_atomic_cas_i64(dest=0x16933124, exch=<unavailable>, comp=<unavailable>) at atomic.c:519 [opt]
   516 	gint64
   517 	mono_atomic_cas_i64(volatile gint64 *dest, gint64 exch, gint64 comp)
   518 	{
-> 519 		return  __sync_val_compare_and_swap (dest, comp, exch);
   520 	}
   521
   522 	#elif defined (TARGET_ANDROID)
(lldb) up
frame #1: 0x006292ea mini`ves_icall_System_Threading_ThreadPool_NotifyWorkItemQueued [inlined] mono_atomic_inc_i64 at atomic.h:397 [opt]
   394 		do {
   395 			get = *val;
   396 			set = get + 1;
-> 397 		} while (mono_atomic_cas_i64 (val, set, get) != get);
   398 		return set;
   399 	}
   400
(lldb) up
frame #2: 0x006292d6 mini`ves_icall_System_Threading_ThreadPool_NotifyWorkItemQueued at threadpool.c:743 [opt]
   740 	ves_icall_System_Threading_ThreadPool_NotifyWorkItemQueued (void)
   741 	{
   742 	#ifndef DISABLE_PERFCOUNTERS
-> 743 		mono_atomic_inc_i64 (&mono_perfcounters->threadpool_workitems);
   744 	#endif
   745 	}
   746
```

Note that the member `threadpool_workitems` is on an unnatural alignment
(`0x16933124`) regarding to its type `gint64`.

related xamarin/xamarin-macios#3826
monojenkins pushed a commit to monojenkins/mono that referenced this issue Mar 29, 2018
clang fails to properly align 64bit members of the `MonoPerfCounters` struct on
32bit builds:

```
* thread mono#1, name = 'tid_403', queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=EXC_ARM_DA_ALIGN, address=0x16933124)
    frame #0: 0x0066f4b2 mini`mono_atomic_cas_i64(dest=0x16933124, exch=<unavailable>, comp=<unavailable>) at atomic.c:519 [opt]
   516 	gint64
   517 	mono_atomic_cas_i64(volatile gint64 *dest, gint64 exch, gint64 comp)
   518 	{
-> 519 		return  __sync_val_compare_and_swap (dest, comp, exch);
   520 	}
   521
   522 	#elif defined (TARGET_ANDROID)
(lldb) up
frame mono#1: 0x006292ea mini`ves_icall_System_Threading_ThreadPool_NotifyWorkItemQueued [inlined] mono_atomic_inc_i64 at atomic.h:397 [opt]
   394 		do {
   395 			get = *val;
   396 			set = get + 1;
-> 397 		} while (mono_atomic_cas_i64 (val, set, get) != get);
   398 		return set;
   399 	}
   400
(lldb) up
frame mono#2: 0x006292d6 mini`ves_icall_System_Threading_ThreadPool_NotifyWorkItemQueued at threadpool.c:743 [opt]
   740 	ves_icall_System_Threading_ThreadPool_NotifyWorkItemQueued (void)
   741 	{
   742 	#ifndef DISABLE_PERFCOUNTERS
-> 743 		mono_atomic_inc_i64 (&mono_perfcounters->threadpool_workitems);
   744 	#endif
   745 	}
   746
```

Note that the member `threadpool_workitems` is on an unnatural alignment
(`0x16933124`) regarding to its type `gint64`.

related xamarin/xamarin-macios#3826
monojenkins pushed a commit to mono/mono that referenced this issue Mar 30, 2018
clang fails to properly align 64bit members of the `MonoPerfCounters` struct on
32bit builds:

```
* thread #1, name = 'tid_403', queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=EXC_ARM_DA_ALIGN, address=0x16933124)
    frame #0: 0x0066f4b2 mini`mono_atomic_cas_i64(dest=0x16933124, exch=<unavailable>, comp=<unavailable>) at atomic.c:519 [opt]
   516 	gint64
   517 	mono_atomic_cas_i64(volatile gint64 *dest, gint64 exch, gint64 comp)
   518 	{
-> 519 		return  __sync_val_compare_and_swap (dest, comp, exch);
   520 	}
   521
   522 	#elif defined (TARGET_ANDROID)
(lldb) up
frame #1: 0x006292ea mini`ves_icall_System_Threading_ThreadPool_NotifyWorkItemQueued [inlined] mono_atomic_inc_i64 at atomic.h:397 [opt]
   394 		do {
   395 			get = *val;
   396 			set = get + 1;
-> 397 		} while (mono_atomic_cas_i64 (val, set, get) != get);
   398 		return set;
   399 	}
   400
(lldb) up
frame #2: 0x006292d6 mini`ves_icall_System_Threading_ThreadPool_NotifyWorkItemQueued at threadpool.c:743 [opt]
   740 	ves_icall_System_Threading_ThreadPool_NotifyWorkItemQueued (void)
   741 	{
   742 	#ifndef DISABLE_PERFCOUNTERS
-> 743 		mono_atomic_inc_i64 (&mono_perfcounters->threadpool_workitems);
   744 	#endif
   745 	}
   746
```

Note that the member `threadpool_workitems` is on an unnatural alignment
(`0x16933124`) regarding to its type `gint64`.

related xamarin/xamarin-macios#3826
@lewurm
Copy link
Contributor

lewurm commented Mar 30, 2018

should be fixed by 4aa8444

@GouriKumari
Copy link
Contributor Author

Verified with XI build Version: 11.11.0.317 (Visual Studio Community) Hash: f45440b. Apps are launching and executing successfully on 32 bit device.

Logs:

Build log: https://gist.github.com/GouriKumari/0b34927fd30db3565d2944e68a9bfd95
Test Log: https://gist.github.com/GouriKumari/f3b3d1cace01bb61aa25f11502c12f65
Test Env: https://gist.github.com/GouriKumari/63bd391f383286c9103ecd5d5e9c177b

@GouriKumari
Copy link
Contributor Author

Closing this issue.

picenka21 pushed a commit to picenka21/runtime that referenced this issue Feb 18, 2022
clang fails to properly align 64bit members of the `MonoPerfCounters` struct on
32bit builds:

```
* thread mono/mono#1, name = 'tid_403', queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=EXC_ARM_DA_ALIGN, address=0x16933124)
    frame mono/mono#0: 0x0066f4b2 mini`mono_atomic_cas_i64(dest=0x16933124, exch=<unavailable>, comp=<unavailable>) at atomic.c:519 [opt]
   516 	gint64
   517 	mono_atomic_cas_i64(volatile gint64 *dest, gint64 exch, gint64 comp)
   518 	{
-> 519 		return  __sync_val_compare_and_swap (dest, comp, exch);
   520 	}
   521
   522 	#elif defined (TARGET_ANDROID)
(lldb) up
frame mono/mono#1: 0x006292ea mini`ves_icall_System_Threading_ThreadPool_NotifyWorkItemQueued [inlined] mono_atomic_inc_i64 at atomic.h:397 [opt]
   394 		do {
   395 			get = *val;
   396 			set = get + 1;
-> 397 		} while (mono_atomic_cas_i64 (val, set, get) != get);
   398 		return set;
   399 	}
   400
(lldb) up
frame mono/mono#2: 0x006292d6 mini`ves_icall_System_Threading_ThreadPool_NotifyWorkItemQueued at threadpool.c:743 [opt]
   740 	ves_icall_System_Threading_ThreadPool_NotifyWorkItemQueued (void)
   741 	{
   742 	#ifndef DISABLE_PERFCOUNTERS
-> 743 		mono_atomic_inc_i64 (&mono_perfcounters->threadpool_workitems);
   744 	#endif
   745 	}
   746
```

Note that the member `threadpool_workitems` is on an unnatural alignment
(`0x16933124`) regarding to its type `gint64`.

related xamarin/xamarin-macios#3826


Commit migrated from mono/mono@a36d08a
@ghost ghost locked as resolved and limited conversation to collaborators May 6, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug If an issue is a bug or a pull request a bug fix iOS Issues affecting Xamarin.iOS
Projects
None yet
Development

No branches or pull requests

5 participants