SIGSEGV failures after Xamarin.Android 4.8 upgrade

I upgraded my Windows and Mac workstations to Xamarin.Android 4.8 this morning and ran our integration tests. The Android integration tests are now failing with various SIGSEGV errors. Here's an example:

07-25 14:32:43.787 F/        ( 3641): * Assertion at /Users/builder/data/lanes/monodroid-mlion-monodroid-4.8.0-branch/3f1c339b/source/mono/mono/mini/mini.c:3806, condition `l' not met
07-25 14:32:43.797 E/mono-rt ( 3641): Stacktrace:
07-25 14:32:43.797 E/mono-rt ( 3641): 
07-25 14:32:43.797 E/mono-rt ( 3641):   at <unknown> <0xffffffff>
07-25 14:32:43.797 E/mono-rt ( 3641):   at {Application}.{Project}.Thread.ThreadInfo.get_Instance () <IL 0x0000f, 0x0005f>
07-25 14:32:43.797 E/mono-rt ( 3641):   at Test.{Application}.{Project}.Thread.ThreadInfoTest.Instance () <IL 0x0000c, 0x00043>
07-25 14:32:43.797 E/mono-rt ( 3641):   at (wrapper runtime-invoke) object.runtime_invoke_void__this__ (object,intptr,intptr,intptr) <IL 0x0004e, 0xffffffff>
07-25 14:32:43.797 E/mono-rt ( 3641):   at <unknown> <0xffffffff>
07-25 14:32:43.797 E/mono-rt ( 3641):   at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&) <IL 0x00030, 0xffffffff>
07-25 14:32:43.797 E/mono-rt ( 3641):   at System.Reflection.MonoMethod.Invoke (object,System.Reflection.BindingFlags,System.Reflection.Binder,object[],System.Globalization.CultureInfo) <IL 0x0004a, 0x0016b>
07-25 14:32:43.797 E/mono-rt ( 3641):   at System.Reflection.MethodBase.Invoke (object,object[]) <IL 0x00006, 0x00048>
07-25 14:32:43.797 E/mono-rt ( 3641):   at NUnit.Framework.Internal.Reflect.InvokeMethod (System.Reflection.MethodInfo,object,object[]) <IL 0x00027, 0x000eb>
07-25 14:32:43.797 E/mono-rt ( 3641):   at NUnit.Framework.Internal.Commands.TestMethodCommand.Execute (NUnit.Framework.Internal.TestExecutionContext) <IL 0x00017, 0x0006f>
07-25 14:32:43.797 E/mono-rt ( 3641):   at NUnit.Framework.Internal.Commands.SetUpTearDownCommand.Execute (NUnit.Framework.Internal.TestExecutionContext) <IL 0x0000f, 0x00056>
07-25 14:32:43.797 E/mono-rt ( 3641):   at NUnit.Framework.Internal.WorkItems.SimpleWorkItem.PerformWork () <IL 0x0000d, 0x00060>
07-25 14:32:43.797 E/mono-rt ( 3641):   at NUnit.Framework.Internal.WorkItems.WorkItem.RunTest () <IL 0x00054, 0x0016f>
07-25 14:32:43.797 E/mono-rt ( 3641):   at NUnit.Framework.Internal.WorkItems.WorkItem.Execute () <IL 0x00065, 0x001ef>
07-25 14:32:43.797 E/mono-rt ( 3641):   at NUnit.Framework.Internal.WorkItems.CompositeWorkItem.RunChildren () <IL 0x00037, 0x00184>
07-25 14:32:43.797 E/mono-rt ( 3641):   at NUnit.Framework.Internal.WorkItems.CompositeWorkItem.PerformWork () <IL 0x000a6, 0x002ff>
07-25 14:32:43.797 E/mono-rt ( 3641):   at NUnit.Framework.Internal.WorkItems.WorkItem.RunTest () <IL 0x00054, 0x0016f>
07-25 14:32:43.797 E/mono-rt ( 3641):   at NUnit.Framework.Internal.WorkItems.WorkItem.Execute () <IL 0x00065, 0x001ef>
07-25 14:32:43.797 E/mono-rt ( 3641):   at NUnit.Framework.Internal.WorkItems.CompositeWorkItem.RunChildren () <IL 0x00037, 0x00184>
07-25 14:32:43.797 E/mono-rt ( 3641):   at NUnit.Framework.Internal.WorkItems.CompositeWorkItem.PerformWork () <IL 0x000a6, 0x002ff>
07-25 14:32:43.797 E/mono-rt ( 3641):   at NUnit.Framework.Internal.WorkItems.WorkItem.RunTest () <IL 0x00054, 0x0016f>
07-25 14:32:43.797 E/mono-rt ( 3641):   at NUnit.Framework.Internal.WorkItems.WorkItem.Execute () <IL 0x00065, 0x001ef>
07-25 14:32:43.797 E/mono-rt ( 3641):   at NUnit.Framework.Internal.NUnitLiteTestAssemblyRunner.Run (NUnit.Framework.Api.ITestListener,NUnit.Framework.Api.ITestFilter) <IL 0x00056, 0x0016d>
07-25 14:32:43.797 E/mono-rt ( 3641):   at NUnitLite.Runner.TextUI.RunTests (NUnit.Framework.Api.ITestFilter) <IL 0x00008, 0x00044>
07-25 14:32:43.797 E/mono-rt ( 3641):   at NUnitLite.Runner.TextUI.Execute (string[]) <IL 0x001b2, 0x0071b>
07-25 14:32:43.797 E/mono-rt ( 3641):   at Test.{Application}.{Project}.Activity1.OnCreate (Android.OS.Bundle) <IL 0x00078, 0x00223>
07-25 14:32:43.797 E/mono-rt ( 3641):   at Android.App.Activity.n_OnCreate_Landroid_os_Bundle_ (intptr,intptr,intptr) <IL 0x00012, 0x00081>
07-25 14:32:43.797 E/mono-rt ( 3641):   at (wrapper dynamic-method) object.b7259208-3ecc-4dda-8032-524dadcfa28d (intptr,intptr,intptr) <IL 0x00017, 0x0001f>
07-25 14:32:43.797 E/mono-rt ( 3641):   at (wrapper native-to-managed) object.b7259208-3ecc-4dda-8032-524dadcfa28d (intptr,intptr,intptr) <IL 0x00023, 0xffffffff>
07-25 14:32:43.797 E/mono-rt ( 3641): 
07-25 14:32:43.797 E/mono-rt ( 3641): =================================================================
07-25 14:32:43.797 E/mono-rt ( 3641): Got a SIGSEGV while executing native code. This usually indicates
07-25 14:32:43.797 E/mono-rt ( 3641): a fatal error in the mono runtime or one of the native libraries 
07-25 14:32:43.797 E/mono-rt ( 3641): used by your application.
07-25 14:32:43.797 E/mono-rt ( 3641): =================================================================
07-25 14:32:43.797 E/mono-rt ( 3641): 
The program 'Mono' has exited with code 0 (0x0).

The code in question looks like this:

public static ThreadInfo Instance 
{
    get
    {
        System.Threading.Thread currentThread = System.Threading.Thread.CurrentThread;

        if (IsThreadNew(currentThread))
        {
            return CreateThreadInfo(currentThread);
        }

        return _threadInfos[currentThread.Name];
    }
}

Disabling the test fixture which calls this code just leads to other similar looking SIGSEGV errors in other tests. So, I suspect it's not a problem with the code itself. Besides, the code works with Xamarin Android 4.7.

I'm testing with Visual Studio on Windows 8 and Xamarin Studio on OSX. In both cases, I'm deploying to a Galaxy Nexus emulator using the Intel x86 Atom System Image. The Intel HAXM hypervisor is installed and enabled. GPU emulation is enabled.

The release notes state that an IDE restart may be required. I have tried restarting Visual Studio and Xamarin Studio, cleaning the solution, manually deleting all build artifacts (bin and obj folders), and recreating the emulator.

I'm not sure what else to try.

Posts

  • JeremyKolbJeremyKolb USMember ✭✭✭

    I'm seeing the exact same thing when calling a method marked as Synchronized on a Motorola Xoom.

  • BenjaminRogersBenjaminRogers USMember

    That's an interesting observation. The Instance property itself is not marked synchronized, but the CreateThreadInfo method is.

  • JeremyKolbJeremyKolb USMember ✭✭✭

    Yeah. I'm not sure if it's due to inlining or it's stomping the stack but I see that it never seems to get the last few stack frames.

  • MikaKorhonenMikaKorhonen FIMember

    Something must get wrong with the update.

    JeremyKolb: Nice found, I do have similar errors in synchronized threads...

  • BenjaminRogersBenjaminRogers USMember
    edited July 2013

    I've confirmed that all the errors I'm seeing are related to MethodImplOptions.Synchronized. In every case, the the stack trace points to the call site, not the synchronized member.

    It appears the issue has already been reported:

    https://bugzilla.xamarin.com/show_bug.cgi?id=13491

  • RodrigoKumperaRodrigoKumpera USMember, Xamarin Team Xamurai

    Hey Guys, we managed to reproduce it and it will be fixed in 4.8.1

  • BenjaminRogersBenjaminRogers USMember

    Good to hear. Thanks for the heads up.

  • ThomasWeidmanThomasWeidman USMember, Beta

    Is there a fix until 4.8.1 is released?

  • JeremyKolbJeremyKolb USMember ✭✭✭

    Not that I know of.

  • AllenBenzAllenBenz USMember

    Downgrading to the previous version is probably the "fix" until 4.8.1

  • Ryan.LangtonRyan.Langton USMember

    Too bad Xamarin makes it nearly impossible to downgrade their product.

  • angelocarlottoangelocarlotto BRMember ✭✭

    I´m facing the same problem. Do i have to wait until 4.8.1 realse? Theres is any thing i could do until the realse?

  • moljacmoljac HRBeta ✭✭✭

    Just to report it is fixed in 4.8.1.

    I had similar behaviour in SharpSerializer port
    http://forums.xamarin.com/discussion/comment/22334/#Comment_22334

  • ScottSuppanScottSuppan USMember

    I having the same problem in 4.8.1
    The app runs for a second or two and then crashes hard with SIGSEGV.

  • ScottSuppanScottSuppan USMember

    We found a place in our code that consistently causes the SIGSEGV to occur in 4.8.1.
    The issue is centered around thread safety. We are displaying a wait cursor and attempting to quit. Please see the following bug on bugzilla for more detail:
    https://bugzilla.xamarin.com/show_bug.cgi?id=13962

  • KarenCateKarenCate USMember ✭✭

    I am not sure this is related, but I am also having bizzare SIGSEGV crashes today.

    First the stack trace:

    [mono-rt] Stacktrace:
    [mono-rt] 
    [mono-rt]   at <unknown> <0xffffffff>
    [mono-rt]   at (wrapper managed-to-native) object.wrapper_native_0x40732e29 (intptr,intptr,intptr) <IL 0x00027, 0xffffffff>
    [mono-rt]   at Android.Runtime.JNIEnv.CallObjectMethod (intptr,intptr) [0x00005] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.8.0-branch/b76e8ec4/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:129
    [mono-rt]   at Java.Lang.Object.ToString () [0x00043] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.8.0-branch/b76e8ec4/source/monodroid/src/Mono.Android/platforms/android-10/src/generated/Java.Lang.Object.cs:198
    [mono-rt]   at (wrapper runtime-invoke) <Module>.runtime_invoke_object__this__ (object,intptr,intptr,intptr) <IL 0x00050, 0xffffffff>
    [mono-rt]   at <unknown> <0xffffffff>
    [mono-rt]   at Plants.ProductListAdapter.OnTextChange (object,System.EventArgs) [0x00014] in /Users/karenc/Projects/MobileDevelopment/Plants.Android/ProductListAdapter.cs:90
    [mono-rt]   at Android.Text.TextWatcherImplementor.Android.Text.ITextWatcher.AfterTextChanged (Android.Text.IEditable) [0x0000d] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.8.0-branch/b76e8ec4/source/monodroid/src/Mono.Android/src/Android.Text/ITextWatcher.cs:73
    [mono-rt]   at Android.Text.ITextWatcherInvoker.n_AfterTextChanged_Landroid_text_Editable_ (intptr,intptr,intptr) [0x00010] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.8.0-branch/b76e8ec4/source/monodroid/src/Mono.Android/platforms/android-10/src/generated/Android.Text.ITextWatcher.cs:97
    [mono-rt]   at (wrapper dynamic-method) object.863895fd-aabd-43f5-ba37-1535c07173b3 (intptr,intptr,intptr) <IL 0x00017, 0x00043>
    [mono-rt]   at (wrapper native-to-managed) object.863895fd-aabd-43f5-ba37-1535c07173b3 (intptr,intptr,intptr) <IL 0x00023, 0xffffffff>
    [mono-rt] 
    [mono-rt] =================================================================
    [mono-rt] Got a SIGSEGV while executing native code. This usually indicates
    [mono-rt] a fatal error in the mono runtime or one of the native libraries 
    [mono-rt] used by your application.
    [mono-rt] =================================================================
    [mono-rt] 
    

    The code that causes it:

    public void OnTextChange(object sender, EventArgs e)
    {
        EditText qty = (EditText) sender;
        string tmp = qty.Text.ToString();    // <-- Here
        ...
    }
    

    I have a breakpoint on that first line, and sender is, in fact, an EditText, and it's Text property is "1".

    This callback is assigned in a GetView function like so:

    EditText qty = (EditText) view.FindViewById<EditText>(Resource.Id.availQty);
    qty.AfterTextChanged += new EventHandler<AfterTextChangedEventArgs>(OnTextChange);
    

    I thought I was closing in on a stable build, now I can't get anything to work. Again. This happened when I tried the beta build of 4.8.1, going back to stable and reloading my project from a backup fixed it.

    I really need a build for a tradeshow next week, I hope we can find some way to fix or workaround this issue!

  • rmaciasrmacias USBeta, University ✭✭✭✭✭

    Any reason you need Beta 4.8.1? The latest stable version is 4.8.2.

  • KarenCateKarenCate USMember ✭✭
    edited August 2013

    That was, in theory, 4.8.2. I meant that I had this problem a couple of weeks ago when I tried the beta of 4.8.1, and was able to fix it by wiping out and reloading my project directory from a backup. That is not working this time. As an update, I tried to remove and re-install 4.8.0, which was working, and have it completely non-functional now. Xamarin Studio comes up, but there are no menus. None. Not even check for updates.

    sigh

    Update: By running the installer on top of what was already installed, I got Xamarin Studio working. After spending four hours at this, it still doesn't work. I now desperately need help and will start a new thread. Oh, and according to my downloader, 4.8.1 is the current stable release.

  • rmaciasrmacias USBeta, University ✭✭✭✭✭

    I was referencing Xamarin.Android. The latest stable is 4.8.2:

    http://docs.xamarin.com/releases/android/xamarin.android_4/xamarin.android_4.8#Xamarin.Android_4.8.2

    Xamarin.Android is the relevant component and fixes the majority of the SIGSEGV issues people are seeing.

  • KarenCateKarenCate USMember ✭✭
    edited August 2013

    The updater claims that I'm up to date, and shows Xamarin.Android 4.8.2 in the alpha channel. I'm running on a Mac, is it a version behind?

    Also interesting, the SIGSEGV doesn't happen if I don't set the breakpoint. While this is still a problem, I might be chasing the wrong ghost.

  • KarenCateKarenCate USMember ✭✭
    edited August 2013

    Downloaded the Alpha version (listed as 4.8.2), no change using the emulator.

    Update: It sometimes crashes without the breakpoint. It always crashes with the breakpoint ... even if the breakpoint is AFTER the line that crashes.

  • DavidSchulteDavidSchulte USMember
    edited September 2013

    Never mind. This may have been a gref issue.
    Sorry.

Sign In or Register to comment.