Bug 13962 - App crashes in emulator immediately after running in debug mode
Summary: App crashes in emulator immediately after running in debug mode
Status: RESOLVED NORESPONSE
Alias: None
Product: Android
Classification: Xamarin
Component: Mono runtime / AOT Compiler ()
Version: 4.8.x
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: ---
Assignee: Jonathan Pryor
URL:
Depends on:
Blocks:
 
Reported: 2013-08-13 19:35 UTC by Scott
Modified: 2013-12-05 18:35 UTC (History)
1 user (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 Developer Community or GitHub 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 NORESPONSE

Description Scott 2013-08-13 19:35:11 UTC
I had recently reinstalled the Xamarin Studio app since an update had corrupted it beyond execution.
[See Allie Miller for more details]

After reinstalling the Xamarin Studio app, I observed a runtime issue with my android applications.  
The android application I created runs for a few seconds only and then crashes with a SIGSEGV error.
I had also noticed that Xamarin Studio is having trouble detecting the emulator I am running via the "adb connect ....." command.  I have to run that command multiple times before it appears in the "Select Device" dialog.
I'm not sure if this has anything to do with what is happening during runtime.


=== Xamarin Studio ===

Version 4.0.12 (build 3)
Installation UUID: e893eb9f-dc10-4c5a-8d50-32e410360645
Runtime:
	Mono 3.2.0 ((no/7c7fcc7)
	GTK 2.24.20
	GTK# (2.12.0.0)
	Package version: 302000000

=== Apple Developer Tools ===

Xcode 4.6.3 (2068)
Build 4H1503

=== Xamarin.Mac ===

Xamarin.Mac: Not Installed

=== Xamarin.Android ===

Version: 4.8.1 (Enterprise Edition)
Android SDK: /Users/ssuppan/Library/Developer/Xamarin/android-sdk-mac_x86
	Supported Android versions:
		2.1   (API level 7)
		2.2   (API level 8)
		2.3   (API level 10)
		3.1   (API level 12)
		4.0   (API level 14)
		4.0.3 (API level 15)
Java SDK: /usr
java version "1.6.0_51"
Java(TM) SE Runtime Environment (build 1.6.0_51-b11-457-11M4509)
Java HotSpot(TM) 64-Bit Server VM (build 20.51-b01-457, mixed mode)

=== Xamarin.iOS ===

Version: 6.4.1.1 (Enterprise Edition)
Hash: 5a0fe54
Branch: 
Build date: 2013-30-07 08:24:03-0400

=== Build Information ===

Release ID: 400120003
Git revision: 593d7acb1cb78ceeeb482d5133cf1fe514467e39
Build date: 2013-08-07 20:30:53+0000
Xamarin addins: 25a0858b281923e666b09259ad4746b774e0a873

=== Operating System ===

Mac OS X 10.8.4
Darwin BED-MAC64AGDRJCs-MacBook-Pro.local 12.4.0 Darwin Kernel Version 12.4.0
    Wed May  1 17:57:12 PDT 2013
    root:xnu-2050.24.15~1/RELEASE_X86_64 x86_64

================
runtime output

08-13 19:26:13.456 D/AndroidRuntime( 1981): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
08-13 19:26:13.456 D/AndroidRuntime( 1981): CheckJNI is ON
08-13 19:26:13.476 I/ethernet( 1981): Loading ethernet jni class
08-13 19:26:13.486 D/AndroidRuntime( 1981): Calling main entry com.android.commands.pm.Pm
08-13 19:26:13.486 D/AndroidRuntime( 1981): Shutting down VM
08-13 19:26:13.486 D/dalvikvm( 1981): GC_CONCURRENT freed 95K, 83% free 450K/2560K, paused 0ms+0ms
08-13 19:26:13.496 I/AndroidRuntime( 1981): NOTE: attach of thread 'Binder Thread #1' failed
08-13 19:26:13.726 D/AndroidRuntime( 1993): 
08-13 19:26:13.726 D/AndroidRuntime( 1993): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
08-13 19:26:13.726 D/AndroidRuntime( 1993): CheckJNI is ON
08-13 19:26:13.746 I/ethernet( 1993): Loading ethernet jni class
08-13 19:26:13.766 D/AndroidRuntime( 1993): Calling main entry com.android.commands.am.Am
08-13 19:26:13.766 D/dalvikvm( 2001): Not late-enabling CheckJNI (already on)
08-13 19:26:13.766 I/ActivityManager( 1273): Start proc TargetDroid.TargetDroid for broadcast TargetDroid.TargetDroid/mono.android.Seppuku: pid=2001 uid=10080 gids={1015, 3003}
08-13 19:26:13.786 I/ActivityThread( 2001): Pub TargetDroid.TargetDroid.mono.MonoRuntimeProvider.__mono_init__: mono.MonoRuntimeProvider
08-13 19:26:13.786 D/dalvikvm( 2001): Trying to load lib /data/data/TargetDroid.TargetDroid/lib/libmonodroid.so 0xa065ff60
08-13 19:26:13.786 D/dalvikvm( 2001): Added shared lib /data/data/TargetDroid.TargetDroid/lib/libmonodroid.so 0xa065ff60
08-13 19:26:13.926 D/AndroidRuntime( 2017): 
08-13 19:26:13.926 D/AndroidRuntime( 2017): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
08-13 19:26:13.926 D/AndroidRuntime( 2017): CheckJNI is ON
08-13 19:26:13.946 I/ethernet( 2017): Loading ethernet jni class
08-13 19:26:13.956 D/AndroidRuntime( 2017): Calling main entry com.android.commands.am.Am
08-13 19:26:13.956 D/AndroidRuntime( 1993): Shutting down VM
08-13 19:26:13.956 D/dalvikvm( 1993): GC_CONCURRENT freed 98K, 82% free 474K/2560K, paused 0ms+0ms
08-13 19:26:13.956 D/AndroidRuntime( 2017): Shutting down VM
08-13 19:26:13.956 D/dalvikvm( 2017): GC_CONCURRENT freed 93K, 83% free 440K/2560K, paused 1ms+0ms
08-13 19:26:13.956 I/AndroidRuntime( 1993): NOTE: attach of thread 'Binder Thread #3' failed
08-13 19:26:13.956 I/AndroidRuntime( 2017): NOTE: attach of thread 'Binder Thread #1' failed
08-13 19:26:13.956 I/ActivityManager( 1273): Force stopping package TargetDroid.TargetDroid uid=10080
08-13 19:26:13.956 I/ActivityManager( 1273): Killing proc 2001:TargetDroid.TargetDroid/10080: force stop
08-13 19:26:14.196 D/dalvikvm( 1517): GC_CONCURRENT freed 506K, 8% free 6906K/7495K, paused 0ms+0ms
08-13 19:26:14.856 D/AndroidRuntime( 2041): 
08-13 19:26:14.856 D/AndroidRuntime( 2041): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
08-13 19:26:14.856 D/AndroidRuntime( 2041): CheckJNI is ON
08-13 19:26:14.896 I/ethernet( 2041): Loading ethernet jni class
08-13 19:26:14.896 D/AndroidRuntime( 2041): Calling main entry com.android.commands.am.Am
08-13 19:26:14.896 I/ActivityManager( 1273): START {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=TargetDroid.TargetDroid/targetdroid.SplashActivity} from pid 2041
08-13 19:26:14.906 D/dalvikvm( 1273): GC_FOR_ALLOC freed 1203K, 16% free 8683K/10247K, paused 6ms
08-13 19:26:14.906 I/dalvikvm-heap( 1273): Grow heap (frag case) to 10.002MB for 1536012-byte allocation
08-13 19:26:14.926 D/dalvikvm( 1273): GC_FOR_ALLOC freed 28K, 14% free 10154K/11783K, paused 5ms
08-13 19:26:14.956 D/dalvikvm( 1273): GC_CONCURRENT freed 2K, 14% free 10159K/11783K, paused 1ms+1ms
08-13 19:26:14.956 D/AndroidRuntime( 2041): Shutting down VM
08-13 19:26:14.956 D/dalvikvm( 2041): GC_CONCURRENT freed 97K, 82% free 471K/2560K, paused 0ms+0ms
08-13 19:26:14.956 I/AndroidRuntime( 2041): NOTE: attach of thread 'Binder Thread #3' failed
08-13 19:26:14.956 D/dalvikvm( 2052): Not late-enabling CheckJNI (already on)
08-13 19:26:14.956 W/WindowManager( 1273): Failure taking screenshot for (230x306) to layer 21010
08-13 19:26:14.956 I/ActivityManager( 1273): Start proc TargetDroid.TargetDroid for activity TargetDroid.TargetDroid/targetdroid.SplashActivity: pid=2052 uid=10080 gids={1015, 3003}
08-13 19:26:15.026 I/ActivityThread( 2052): Pub TargetDroid.TargetDroid.mono.MonoRuntimeProvider.__mono_init__: mono.MonoRuntimeProvider
08-13 19:26:15.036 D/dalvikvm( 2052): Trying to load lib /data/data/TargetDroid.TargetDroid/lib/libmonodroid.so 0xa0660ad8
08-13 19:26:15.036 D/dalvikvm( 2052): Added shared lib /data/data/TargetDroid.TargetDroid/lib/libmonodroid.so 0xa0660ad8
08-13 19:26:15.246 W/MonoDroid-Debugger( 2052): Trying to initialize the debugger with options: --debugger-agent=transport=dt_socket,loglevel=0,address=127.0.0.1:8889,server=y,embedding=1
08-13 19:26:15.666 W/MonoDroid-Debugger( 2052): Accepted stdout connection: 41
08-13 19:26:19.766 W/monodroid-gc( 2052): GREF GC Threshold: 46800
08-13 19:26:22.026 I/ActivityManager( 1273): No longer want com.android.deskclock (pid 1671): hidden #16
08-13 19:26:22.946 D/dalvikvm( 2052): GC_EXPLICIT freed 149K, 4% free 6574K/6791K, paused 1ms+1ms
08-13 19:26:23.086 W/IInputConnectionWrapper( 1894): showStatusIcon on inactive InputConnection
08-13 19:26:23.086 W/InputManagerService( 1273): Starting input on non-focused client com.android.internal.view.IInputMethodClient$Stub$Proxy@a0968af0 (uid=10001 pid=1894)
08-13 19:26:23.096 I/ActivityManager( 1273): Displayed TargetDroid.TargetDroid/targetdroid.SplashActivity: +8s140ms
08-13 19:26:23.316 D/dalvikvm( 2052): GC_FOR_ALLOC freed 9K, 3% free 6607K/6791K, paused 2ms
08-13 19:26:23.316 I/dalvikvm-heap( 2052): Grow heap (frag case) to 7.971MB for 1536012-byte allocation
08-13 19:26:23.326 D/dalvikvm( 2052): GC_FOR_ALLOC freed <1K, 3% free 8107K/8327K, paused 2ms
08-13 19:26:23.336 D/dalvikvm( 2052): GC_CONCURRENT freed 0K, 3% free 8107K/8327K, paused 1ms+1ms
08-13 19:26:23.426 D/dalvikvm( 2052): GC_CONCURRENT freed 481K, 8% free 8117K/8775K, paused 1ms+0ms
08-13 19:26:23.446 D/dalvikvm( 2052): GC_CONCURRENT freed 440K, 8% free 8117K/8775K, paused 0ms+1ms
08-13 19:26:23.466 D/dalvikvm( 2052): GC_CONCURRENT freed 440K, 8% free 8117K/8775K, paused 0ms+1ms
08-13 19:26:23.476 D/dalvikvm( 2052): GC_CONCURRENT freed 440K, 8% free 8117K/8775K, paused 0ms+0ms
08-13 19:26:23.496 D/dalvikvm( 2052): GC_CONCURRENT freed 440K, 8% free 8117K/8775K, paused 1ms+1ms
08-13 19:26:23.516 D/dalvikvm( 2052): GC_CONCURRENT freed 440K, 8% free 8117K/8775K, paused 1ms+0ms
08-13 19:26:23.526 D/dalvikvm( 2052): GC_CONCURRENT freed 440K, 8% free 8117K/8775K, paused 0ms+0ms
08-13 19:26:23.546 D/dalvikvm( 2052): GC_CONCURRENT freed 440K, 8% free 8117K/8775K, paused 0ms+0ms
08-13 19:26:23.556 D/dalvikvm( 2052): GC_CONCURRENT freed 440K, 8% free 8117K/8775K, paused 0ms+0ms
08-13 19:26:23.576 D/dalvikvm( 2052): GC_CONCURRENT freed 440K, 8% free 8117K/8775K, paused 1ms+1ms
08-13 19:26:23.596 D/dalvikvm( 2052): GC_CONCURRENT freed 440K, 8% free 8117K/8775K, paused 1ms+0ms
08-13 19:26:23.616 D/dalvikvm( 2052): GC_CONCURRENT freed 440K, 8% free 8117K/8775K, paused 0ms+0ms
08-13 19:26:23.626 D/dalvikvm( 2052): GC_CONCURRENT freed 440K, 8% free 8117K/8775K, paused 1ms+1ms
08-13 19:26:23.646 D/dalvikvm( 2052): GC_CONCURRENT freed 440K, 8% free 8117K/8775K, paused 0ms+0ms
08-13 19:26:23.646 D/dalvikvm( 2052): GC_CONCURRENT freed 440K, 8% free 8117K/8775K, paused 0ms+0ms
08-13 19:26:23.686 D/dalvikvm( 2052): GC_CONCURRENT freed 440K, 8% free 8117K/8775K, paused 0ms+0ms
08-13 19:26:23.686 D/dalvikvm( 2052): GC_FOR_ALLOC freed 545K, 8% free 8109K/8775K, paused 2ms
08-13 19:26:24.546 D/dalvikvm( 2052): GC_CONCURRENT freed 426K, 8% free 8119K/8775K, paused 1ms+0ms
08-13 19:26:24.646 D/dalvikvm( 2052): GC_CONCURRENT freed 442K, 8% free 8119K/8775K, paused 0ms+0ms
08-13 19:26:24.656 D/dalvikvm( 2052): GC_EXPLICIT freed 28K, 8% free 8118K/8775K, paused 0ms+0ms
08-13 19:26:24.746 D/dalvikvm( 2052): GC_CONCURRENT freed 440K, 8% free 8118K/8775K, paused 1ms+0ms
08-13 19:26:24.846 D/dalvikvm( 2052): GC_CONCURRENT freed 468K, 8% free 8118K/8775K, paused 4ms+0ms
08-13 19:26:24.936 D/dalvikvm( 2052): GC_CONCURRENT freed 440K, 8% free 8118K/8775K, paused 0ms+0ms
08-13 19:26:24.956 W/ActivityManager( 1273): Launch timeout has expired, giving up wake lock!
08-13 19:26:24.966 W/ActivityManager( 1273): Activity idle timeout for ActivityRecord{a09d8ac8 TargetDroid.TargetDroid/targetdroid.SplashActivity}
08-13 19:26:25.036 D/dalvikvm( 2052): GC_CONCURRENT freed 440K, 8% free 8118K/8775K, paused 0ms+0ms
08-13 19:26:25.136 W/ResourceType( 2052): No package identifier when getting value for resource number 0x00000000
08-13 19:26:32.336 W/ThrottleService( 1273): unable to find stats for iface rmnet0
08-13 19:26:45.106 D/dalvikvm( 1346): GC_CONCURRENT freed 396K, 68% free 7092K/21831K, paused 0ms+1ms
08-13 19:26:46.466 D/dalvikvm( 2052): GC_EXPLICIT freed 354K, 8% free 8121K/8775K, paused 0ms+0ms
08-13 19:26:46.496 I/ActivityManager( 1273): START {flg=0x10018000 cmp=TargetDroid.TargetDroid/targetdroid.LoginActivity (has extras)} from pid 2052
08-13 19:26:46.496 W/WindowManager( 1273): Failure taking screenshot for (230x306) to layer 21020
08-13 19:26:46.556 D/dalvikvm( 2052): GC_EXPLICIT freed 13K, 8% free 8122K/8775K, paused 0ms+0ms
08-13 19:26:46.596 I/ActivityManager( 1273): Displayed TargetDroid.TargetDroid/targetdroid.LoginActivity: +78ms
08-13 19:26:46.646 D/dalvikvm( 2052): GREF has increased to 201
08-13 19:26:46.896 D/dalvikvm( 2052): GC_EXPLICIT freed 56K, 7% free 8229K/8775K, paused 0ms+0ms
08-13 19:26:46.916 D/dalvikvm( 2052): GC_EXPLICIT freed 20K, 7% free 8213K/8775K, paused 0ms+0ms
08-13 19:26:48.596 E/mono-rt ( 2052): Stacktrace:
08-13 19:26:48.596 E/mono-rt ( 2052): 
08-13 19:26:48.596 E/mono-rt ( 2052): 
08-13 19:26:48.596 E/mono-rt ( 2052): =================================================================
08-13 19:26:48.596 E/mono-rt ( 2052): Got a SIGSEGV while executing native code. This usually indicates
08-13 19:26:48.596 E/mono-rt ( 2052): a fatal error in the mono runtime or one of the native libraries 
08-13 19:26:48.596 E/mono-rt ( 2052): used by your application.
08-13 19:26:48.596 E/mono-rt ( 2052): =================================================================
08-13 19:26:48.596 E/mono-rt ( 2052): 
08-13 19:26:48.596 I/ActivityManager( 1273): Process TargetDroid.TargetDroid (pid 2052) has died.
08-13 19:26:48.596 W/ActivityManager( 1273): Force removing ActivityRecord{a080bbb0 TargetDroid.TargetDroid/targetdroid.LoginActivity}: app died, no saved state
08-13 19:26:48.596 I/WindowManager( 1273): WIN DEATH: Window{a091f320 TargetDroid.TargetDroid/targetdroid.LoginActivity paused=false}
08-13 19:26:48.606 D/dalvikvm( 1894): GC_CONCURRENT freed 437K, 8% free 6630K/7175K, paused 0ms+0ms
08-13 19:26:48.606 D/Zygote  ( 1223): Process 2052 exited cleanly (255)
08-13 19:26:48.606 V/PhoneStatusBar( 1346): setLightsOn(true)
08-13 19:26:48.616 W/InputManagerService( 1273): Got RemoteException sending setActive(false) notification to pid 2052 uid 10080
08-13 19:26:48.636 D/AndroidRuntime( 2176): 
08-13 19:26:48.636 D/AndroidRuntime( 2176): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
08-13 19:26:48.636 D/AndroidRuntime( 2176): CheckJNI is ON
08-13 19:26:48.776 I/ethernet( 2176): Loading ethernet jni class
08-13 19:26:48.856 D/AndroidRuntime( 2176): Calling main entry com.android.commands.am.Am
08-13 19:26:48.856 D/AndroidRuntime( 2176): Shutting down VM
08-13 19:26:48.856 D/dalvikvm( 2176): GC_CONCURRENT freed 93K, 83% free 440K/2560K, paused 0ms+1ms
08-13 19:26:48.856 I/AndroidRuntime( 2176): NOTE: attach of thread 'Binder Thread #1' failed
08-13 19:26:48.856 I/ActivityManager( 1273): Force stopping package TargetDroid.TargetDroid uid=10080
Comment 1 Scott 2013-08-13 19:45:06 UTC
I also wanted to add that I'm using the VirtualBox emulator for Android.
I have never had an issue like this before using other versions of Xamarin/Mono For Android.
Comment 2 Scott 2013-08-14 10:09:53 UTC
We figured out what was causing this.

[from an email]
It appears that HandlerThread.Quit is not thread safe in Xamarin's implementation. The solution that I came up eliminates a child thread that I was using to terminate the HandlerThread once it becomes idle, to avoid the droid framework attempting to send the HandlerThread messages after we destroy the dialog used to display the wait cursor in from within the HandlerThread. 
[end email]

I hope that this information may help to narrow down where the problem is and how to solve it.
In the meantime, we are attempting to work around this issue.
Comment 3 Scott 2013-08-14 10:41:02 UTC
Another developer here can reproduce the issue....His findings state:

"a crash will ALWAYS happen when he invokes the threadhandler.quit() from a child thread or a thread other than the UI thread that spawned it or the from the threadhandler itself."
Comment 4 Scott 2013-08-14 10:49:27 UTC
Here is some more log data from the crash caused via the threadhandler.quite().

08-14 10:38:56.795: E/mono-rt(2643): Stacktrace:
08-14 10:38:56.795: E/mono-rt(2643):   at <unknown> <0xffffffff>
08-14 10:38:56.795: E/mono-rt(2643):   at (wrapper managed-to-native) object.wrapper_native_0xb6a5d1e0 (intptr,intptr,intptr) <IL 0x00027, 0xffffffff>
08-14 10:38:56.795: E/mono-rt(2643):   at Android.Runtime.JNIEnv.CallBooleanMethod (intptr,intptr) [0x00000] in /Users/builder/data/lanes/monodroid-mlion-master/33e5abc7/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:152
08-14 10:38:56.795: E/mono-rt(2643):   at Java.Lang.Thread.get_IsAlive () [0x0002d] in /Users/builder/data/lanes/monodroid-mlion-master/33e5abc7/source/monodroid/src/Mono.Android/platforms/android-15/src/generated/Java.Lang.Thread.cs:593
08-14 10:38:56.795: E/mono-rt(2643):   at TargetDroid.CTSSmartWaitCursor.Create (Android.Content.Context,bool,bool,bool) [0x0011b] in /Users/dschulte/My TFS/TargetSFA/TargetSFA/TargetMobileDroid/TargetDroid/TargetDroid/UIUtils/CTSSmartWaitCursor.cs:495
08-14 10:38:56.805: E/mono-rt(2643):   at TargetDroid.CTSSmartWaitCursor.Create (bool,bool,bool) [0x00009] in /Users/dschulte/My TFS/TargetSFA/TargetSFA/TargetMobileDroid/TargetDroid/TargetDroid/UIUtils/CTSSmartWaitCursor.cs:446
08-14 10:38:56.805: E/mono-rt(2643):   at TargetDroid.UniverseSearchActivity.FilterProfLocs (bool) [0x008f8] in /Users/dschulte/My TFS/TargetSFA/TargetSFA/TargetMobileDroid/TargetDroid/TargetDroid/UI/UniverseSearchActivity.cs:4191
08-14 10:38:56.805: E/mono-rt(2643):   at TargetDroid.UniverseSearchActivity.OnActivityResultWhenResumed (int,Android.App.Result,Android.Content.Intent) [0x000fa] in /Users/dschulte/My TFS/TargetSFA/TargetSFA/TargetMobileDroid/TargetDroid/TargetDroid/UI/UniverseSearchActivity.cs:1122
08-14 10:38:56.805: E/mono-rt(2643):   at TargetDroid.BaseActivity.OnResumedAndIdle () [0x00027] in /Users/dschulte/My TFS/TargetSFA/TargetSFA/TargetMobileDroid/TargetDroid/TargetDroid/UI/BaseActivity.cs:739
08-14 10:38:56.805: E/mono-rt(2643):   at TargetDroid.UniverseSearchActivity.OnResumedAndIdle () [0x00002] in /Users/dschulte/My TFS/TargetSFA/TargetSFA/TargetMobileDroid/TargetDroid/TargetDroid/UI/UniverseSearchActivity.cs:1031
08-14 10:38:56.805: E/mono-rt(2643):   at TargetDroid.BaseActivity/IsResumedAndIdleHandler.QueueIdle () [0x00007] in /Users/dschulte/My TFS/TargetSFA/TargetSFA/TargetMobileDroid/TargetDroid/TargetDroid/UI/BaseActivity.cs:132
08-14 10:38:56.805: E/mono-rt(2643):   at Android.OS.MessageQueue/IIdleHandlerInvoker.n_QueueIdle (intptr,intptr) [0x00009] in /Users/builder/data/lanes/monodroid-mlion-master/33e5abc7/source/monodroid/src/Mono.Android/platforms/android-15/src/generated/Android.OS.MessageQueue.cs:75
08-14 10:38:56.805: E/mono-rt(2643):   at (wrapper dynamic-method) object.e0b134b5-b034-4ea2-8e9f-06b496877ff9 (intptr,intptr) <IL 0x00011, 0x0001f>
08-14 10:38:56.805: E/mono-rt(2643):   at (wrapper native-to-managed) object.e0b134b5-b034-4ea2-8e9f-06b496877ff9 (intptr,intptr) <IL 0x00024, 0xffffffff>
08-14 10:38:56.805: E/mono-rt(2643): =================================================================
08-14 10:38:56.805: E/mono-rt(2643): Got a SIGSEGV while executing native code. This usually indicates
08-14 10:38:56.805: E/mono-rt(2643): a fatal error in the mono runtime or one of the native libraries 
08-14 10:38:56.805: E/mono-rt(2643): used by your application.
08-14 10:38:56.805: E/mono-rt(2643): =================================================================
Comment 5 Jonathan Pryor 2013-08-14 16:25:20 UTC
> I also wanted to add that I'm using the VirtualBox emulator for Android.
> I have never had an issue like this before using other versions of Xamarin/Mono
> For Android.

There are known stability issues with VirtualBox that we haven't investigated, e.g. Bug #6081, so I am inclined to suspect VirtualBox (or a bug that exhibits itself on Xamarin.Android/x86).

It's plausible that the VirtualBox instability is a variation of Bug #13957.

> It appears that HandlerThread.Quit is not thread safe in Xamarin's
> implementation.

Xamarin.Android isn't a reimplementation of Android, it's a binding. HandlerThread.Quit() invokes (through JNI) the Java HandlerThread.quit() method, and our binding code is thread-safe.

HandlerThread.quit(), on the other hand, is not explicitly documented as being thread safe, nor is the HandlerThread type itself explicitly documented as being thread-safe:

http://developer.android.com/reference/android/os/HandlerThread.html#quit()

Consequently, I would assume that HandlerThread is not, in fact, thread safe, and code accordingly.

That said, I wouldn't expect a thread safety issue to result in a SIGSEGV.

What _would_ result in a SIGSEGV is invoking a Java method with an invalid handle, e.g. on a disposed object:

    var t = new Java.Lang.Thread ();
    t.Dispose (); // nulls out Handle
    bool alive = t.IsAlive; // BOOM

Are you explicitly disposing of anything? Can you check the value of Java.Lang.Object.Handle at CTSSmartWaitCursor.cs:495 before invoking Thread.IsAlive and see what the JNI handle value is?
Comment 6 PJ 2013-11-19 17:05:27 UTC
This bug has been in the NEEDINFO state with no changes for the last 90 days. Can we put this back into the NEW or CONFIRMED state, or are we still awaiting response?

If there is no change in the status of this bug over the next two weeks, this bug will be marked as NORESPONSE.
Comment 7 PJ 2013-12-05 18:35:50 UTC
This bug has not been changed from the NEEDINFO state since my previous comment, marking as RESOLVED NORESPONSE.

Please feel free to REOPEN this bug at any time if you are still experiencing the issue. Please add the requested information and set the bug back to the NEW (or CONFIRMED) state.