Forum Xamarin Cross Platform with Xamarin

SIGSEGV without stacktrace.

Right after running my application on the iPhone OS 7.0 emulator, during its execution I started facing the next issue:

mono-rt: Stacktrace:


mono-rt: 
Native stacktrace:


mono-rt: 
=================================================================
Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.
=================================================================

When running the same application on the device I cannot reproduce the error.

Is there some way to get more information about what is happening here? As the stacktrace is empty I cannot find where the real problem is.

I am using:

Xamarin Studio
Version 4.1.11 (build 10)
Installation UUID: 1de353f7-02d6-443d-a4fc-841cd9453788
Runtime:
    Mono 3.2.2 ((no/a0fc6ba)
    GTK+ 2.24.20 theme: Raleigh
    GTK# (2.12.0.0)
    Package version: 302020000

Xamarin.Android
Version: 4.8.2 (Business Edition)
Android SDK: /Users/georgepiva/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)
        4.2   (API level 17)
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)

Apple Developer Tools
Xcode 5.0 (3332.22)
Build 5A1412

Xamarin.Mac
Xamarin.Mac: Not Installed

Xamarin.iOS
Version: 6.9.7.13 (Business Edition)
Hash: e7c3c68
Branch: 
Build date: 2013-11-09 22:23:45-0400

Build Information
Release ID: 401110010
Git revision: 6df7ab667918ee55a75f1adc93d53e3c9db392ae
Build date: 2013-09-14 00:09:49+0000
Xamarin addins: 7b3a1cd0b47c2a7b4530aaa2cc5e0077ee1001db

Operating System
Mac OS X 10.8.4
«1

Posts

  • georgepivageorgepiva BRMember
    edited September 2013

    After talking with Allie, I think I was able to get more information about the problem. I have just attached to this post a crash report found at the following local path ~/Library/Logs/DiagnosticReports/. It may help to solve the problem.

  • georgepivageorgepiva BRMember

    Updated crash report.

  • RolfBjarneKvingeRolfBjarneKvinge USXamarin Team Xamurai

    This is an unhandled exception:

    9   AppIOS 0x004a1293 monotouch_unhandled_exception_handler + 291
    

    Try adding a try/catch in your Main method, and print out any exceptions.

    It's still strange though, since this information should be printed to the application output already.

  • ppererapperera USMember

    I'm getting a similar experience to George, and see the monotouch_unhandled_exception_handler in the crash report, though the handler code does not get called (via AppDomain.CurrentDomain.UnhandledException)

  • georgepivageorgepiva BRMember
    edited September 2013

    Hi Rolf, thank you for your initial answer.

    I have just tried to do what you asked me to do:

    try {
        UIApplication.Main (args, null, "AppDelegate");
    } catch (Exception ex) {
        // I put a breakpoint here, but the execution never hits this point...
        Console.WriteLine (ex.Message);
    }
    

    And the Application Output still displaying only the next lines:

    mono-rt: Stacktrace:
    
    
    mono-rt: 
    Native stacktrace:
    
    
    mono-rt: 
    =================================================================
    Got a SIGSEGV while executing native code. This usually indicates
    a fatal error in the mono runtime or one of the native libraries 
    used by your application.
    =================================================================
    

    Today, I am just able to debug my app using a device. Which works fine but then I cannot use "Profile - Mono" feature with them.

  • bradleymanbradleyman USMember

    I am also having this problem. Sudden, previously non-existent SIGSEGV errors, no stack trace. In latest stable Xamarin Studio. Would love an update... Xamarin support directed me to this thread

  • RolfBjarneKvingeRolfBjarneKvinge USXamarin Team Xamurai

    That is indeed very strange. I have a few more questions:

    • Does this happen with all apps, or just this one (i.e. does a new app from a template crash too)?
    • Are you sure the crash report in your second comment is for the crash you're seeing now? The date in the crash report says Sept 16th, but your initial post is from Sept 18th.

    Also please update to the latest stable release (Xamarin.iOS 7.0.0) to check if this has been fixed already.

  • bradleymanbradleyman USMember

    I don't see the problem happening with a new app from the master detail template - that doesn't seem to crash.

  • MatthijsMatthijs USMember, Beta

    I'm experiencing the same issues with the latest version of Xamarin.iOS and they happen very often. No info what so ever, the app doesn't crash but just stops responding and keeps taking CPU load when it's running in the simulator.

    I suppect it to be something like a concurrency issue with releasing objects or something like that... But so far have no clue where to look or how to solve the issue.

  • bradleymanbradleyman USMember

    I have some code that creates an NSURLConnection (using NSURLConnection.FromRequest). I've found that if I comment it out then I don't get the immediate crash.

    Again, this is code that never caused a problem until a recent update to Xamarin Studio. I'm running Version 4.0.12 (build 3) of Xamarin Studio and 7.0.0.11 of Xamarin.iOS.

  • MatthijsMatthijs USMember, Beta

    I just remembered that I did have the same kind of crashes (although not that often) when using Xamarin.iOS 6.4.5 (the latest stable build before 7.0).

    I've spent a few hours of debugging, and trying to find a reproducible test case, but so far I've not managed to.

  • RolfBjarneKvingeRolfBjarneKvinge USXamarin Team Xamurai

    If you have reproducible test cases, please file bugs (with the test case): http://bugzilla.xamarin.com

  • MatthijsMatthijs USMember, Beta

    Sadly I don't, I've tried to create a proper test case but no luck so far. Sadly the issue, and some other issues is holding me back to upgrade to the latest version :-(

  • georgepivageorgepiva BRMember

    Hi Rolf you are right. I took the last crash log I had in the directory, I suppose it was the right one. Right now I was trying generate a new one to post here. But the app is crashing and no crash log is being generated =/ Is there another directory that I can check?

  • MatthijsMatthijs USMember, Beta

    The issue seems to be related to this bug: https://bugzilla.xamarin.com/show_bug.cgi?id=14721

    Now I've replaced most of the:

    new Thread(() => { ; } );

    with:

    ThreadPool.QueueUserWorkItem(new WaitCallback((state) => { ; }));

    The issue seems to occur a lot less.

  • georgepivageorgepiva BRMember
    edited September 2013

    @Matthijs I have just looked inside my project. Unfortunately I have no occurrences of "new Thread". Maybe there is another call generating the same error, or I am using some third party lib which is using it. Anyway, thank you for the information.

  • MatthijsMatthijs USMember, Beta

    Well for one moment I had some hope it might be related to the ThreadPool, but the issue seems far more complex. Using a ThreadPool seems to delay the issue, not to fix it :-(

    @georgepiva Question, when running on a device, do sometimes experience a SIGABRT or SIGSEV mentioning this:

    Assertion at ../../../../../mono/mono/utils/mono-threads.c:155, condition
    `result' not met

  • RolfBjarneKvingeRolfBjarneKvinge USXamarin Team Xamurai

    @georgepiva: are you using SDWebImage? This sounds similar to this: https://bugzilla.xamarin.com/show_bug.cgi?id=11286

  • GeorgeDanilaGeorgeDanila USMember ✭✭

    I'm experiencing the same issue when running my app in the iOS5 and iOS6 simulators (the app does not crash in iOS7). Same empty stacktraces, nothing in the console logs...

    The good thing is that I can reproduce the issue every time. It seems to happen in a piece of code that does a series of web requests. I'm seeing a high density of "Thread Started" and "Thread Finished" messages from the ThreadPool before the app crashes.

  • RolfBjarneKvingeRolfBjarneKvinge USXamarin Team Xamurai

    @GeorgeDanila: if you have a reproducible test case, please file a bug at http://bugzilla.xamarin.com (and attach the test case).

  • EduardoCoelhoEduardoCoelho USMember
    edited October 2013

    I think the problem is related to multiple simultaneous threads.
    I notice that my application outputs the following before crashing:

    Thread started:  #17
    Thread started:  #18
    Thread started:  #19
    Thread started:  #20
    Thread started:  #21
    mono-rt: Stacktrace:
    
    mono-rt: 
    Native stacktrace:
    
    
    mono-rt: 
    =================================================================
    Got a SIGSEGV while executing native code. This usually indicates
    a fatal error in the mono runtime or one of the native libraries 
    used by your application.
    =================================================================
    

    The crash happens very frequently on the simulator, which becomes impossible to debug it.

    I also think that the crash is happening more frequently after the Xamarin.iOS Version: 7.0.2.7 update.

    Xamarin Studio
    Version 4.1.12 (build 6)
    Runtime:
    Mono 3.2.3 ((no/8d3b4b7)
    GTK+ 2.24.20 theme: Raleigh
    GTK# (2.12.0.0)
    Package version: 302030000
    
    Apple Developer Tools
    Xcode 5.0 (3332.22)
    Build 5A1412
    
    Xamarin.iOS
    Version: 7.0.2.7 (Business Edition)
    Hash: 57edee2
    Branch: 
    Build date: 2013-04-10 18:05:51-0400
    

    I can confirm this only happens on the Simulator.

  • GeorgeDanilaGeorgeDanila USMember ✭✭
    edited October 2013

    @RolfBjarneKvinge Unfortunately my attempt to create a demo of the crash has failed. I don't know what else to do honestly. The only way of keeping my app from crashing is setting breakpoints in the areas I know (from tracing) are sensible to the crash and just use Step Over until the heavy multi-threading operations have finished executing.

    Edit: Spelling

  • GeorgeDanilaGeorgeDanila USMember ✭✭

    Also, the weird thing I see in the output is that the traces state that a thread has been started by the ThreadPool once and proceed to state that the specific thread has finished twice:

    Thread finished: #5
    Thread finished: #5
    Thread finished: #4
    Thread finished: #4
    Thread finished: #11
    Thread finished: #11
    Thread started: #14
    Thread finished: #12
    Thread finished: #12
    Thread started: #4
    Thread finished: #14
    Thread finished: #14
    Thread started: #5
    Thread finished: #4
    Thread finished: #4
    Thread started: #15
    Thread finished: #5
    Thread finished: #5
    Thread started: #4
    Thread finished: #15
    Thread finished: #15
    Thread started: #5
    Thread finished: #5
    Thread finished: #5
    Thread started: #15

  • VladislavSimanovichVladislavSimanovich USMember
    edited October 2013

    Had the same problem after updating to latest version of Xamarin.iOS a while ago, not sure when it started. Did all kind of re-installations yesterday and finished with rolling back to old version of Xamarin.iOS (6.4.3.0), as I currently do not need iOS7 support and everything works fine both on Simulator and device. Current setup version is as follows:

    Xamarin Studio
    Version 4.0.13 (build 38)
    Installation UUID: 47efc8db-c292-489e-81ef-bcea7a19471c
    Runtime:
        Mono 3.2.3 ((no/8d3b4b7)
        GTK+ 2.24.20 theme: Raleigh
        GTK# (2.12.0.0)
        Package version: 302030000
    
    Apple Developer Tools
    Xcode 4.6.1 (2067)
    Build 4H512
    
    Xamarin.iOS
    Version: 6.4.3.0 (Business Edition)
    Hash: 0068990
    Branch: 
    Build date: 2013-13-08 05:24:39-0400
    

    Hope this helps.

  • RolfBjarneKvingeRolfBjarneKvinge USXamarin Team Xamurai

    @GeorgeDanila: would it be possible to get access to your full project? You can file private bugs in our bugzilla which only Xamarin employees can see if you don't want to make it public.

    @VladislavSimanovich: we really need a way to reproduce this problem ourselves - so can you create a bug in our bugzilla with either your entire project or a smaller self-contained test case?

  • GeorgeDanilaGeorgeDanila USMember ✭✭

    @RolfBjarneKvinge I'm afraid I cannot provide you with the application code. However I managed to find a workaround for the issue (at least for me). I used the 'Reset Content and Settings' command in the iOS Simulator and this seems to fix the issue for the moment.

  • Found the way: turn off SGen garbage collector

  • JustinAlamagJustinAlamag USMember

    I was able to turn off SGen Garbage Collector but upon building my project I got this error:

    Error MT0004: New refcounting logic requires sgen to be enabled too (MT0004)

    I hope you could help us. Thanks.

  • RolfBjarneKvingeRolfBjarneKvinge USXamarin Team Xamurai

    @JustinAlamag: open the project's options, Build/iOS Build -> Advanced and uncheck 'Use the reference counting extension'.

  • GeorgeDanilaGeorgeDanila USMember ✭✭

    I can confirm that disabling the SGen Garbage Collector in Debug mode fixes the issue for good.

  • SeeD_SeiferSeeD_Seifer UAMember

    I do confirm - disabling SGen in Debug mode for Simulator fixes the issue.
    Though, there is no such crash on the device with SGen turned on.

  • WilliamJockuschWilliamJockusch USMember ✭✭

    How does one disable SGen?

  • RolfBjarneKvingeRolfBjarneKvinge USXamarin Team Xamurai

    @WilliamJockusch‌: in the project's options, go to the iOS Build page, select the Advanced tab and uncheck "Use the SGen generational garbage collector."

  • WilliamJockuschWilliamJockusch USMember ✭✭

    Sorry, should have specified -- I'm seeing this crash in a MonoDroid project.

  • JefimijanaJefimijana USMember ✭✭

    Not in my case. I am trying to test my app on iOS Simulators that run 8.1 version of OS, as well as on iPad 8.1.3 but SIGSEGV still appears

    Got a SIGSEGV while executing native code. This usually indicates
    a fatal error in the mono runtime or one of the native libraries

    =================================================================
    Stopping debugger...
    The program 'Mono' has exited with code 0 (0x0).
    Debugging session ended.

  • I ran into a similar problem on Android (SIGSEGV, no stack trace), turned out to be a vanilla .NET stack overflow due to infinite recursion. I've logged a bug with Xamarin.

  • IliassIliass USMember

    Hi Simon,
    Do you have any updates? what is the bug id you entered?
    I am running on similar random issues with SIGSEGV and no clue what is there, especially no trace logged in the logcat!
    02-19 14:39:00.559: E/mono-rt(18073): Stacktrace: 02-19 14:39:00.559: I/SurfaceFlinger(1886): Device Built-in Screen -> ls 0 02-19 14:39:00.559: E/mono-rt(18073): ================================================================= 02-19 14:39:00.559: E/mono-rt(18073): Got a SIGSEGV while executing native code. This usually indicates 02-19 14:39:00.559: E/mono-rt(18073): a fatal error in the mono runtime or one of the native libraries 02-19 14:39:00.559: E/mono-rt(18073): used by your application. 02-19 14:39:00.559: E/mono-rt(18073): ================================================================= 02-19 14:39:00.559: A/libc(18073): Fatal signal 11 (SIGSEGV) at 0x3f800004 (code=1), thread 18073 (ch.x50.ui.droid)

  • NatxoNatxoNatxoNatxo ESMember
    edited February 2015

    Same problem here, both when debugging in emulator and device, since I added the packet 'SQLiteNetExtensions'.
    It only happens sometimes.

    [mono-rt] Stacktrace:
    [mono-rt]
    [mono-rt] at <0xffffffff>
    [mono-rt] at (wrapper managed-to-native) SQLite.Net.Platform.XamarinAndroid.SQLiteApiAndroidInternal.sqlite3_prepare_v2 (intptr,string,int,intptr&,intptr)
    [mono-rt] at SQLite.Net.Platform.XamarinAndroid.SQLiteApiAndroid.Prepare2 (SQLite.Net.Interop.IDbHandle,string)
    [mono-rt] at SQLite.Net.SQLiteCommand.Prepare ()
    [mono-rt] at SQLite.Net.SQLiteCommand/d__01.MoveNext () <IL 0x00046, 0x000fb> [mono-rt] at System.Collections.Generic.List1.AddEnumerable (System.Collections.Generic.IEnumerable1<T>) <IL 0x0001b, 0x000ec> [mono-rt] at System.Collections.Generic.List1..ctor (System.Collections.Generic.IEnumerable1<T>) <IL 0x00031, 0x0012b> [mono-rt] at System.Linq.Enumerable.ToList<TSource> (System.Collections.Generic.IEnumerable1)
    [mono-rt] at SQLite.Net.SQLiteCommand.ExecuteQuery (SQLite.Net.TableMapping)
    [mono-rt] at SQLite.Net.SQLiteConnection.Query (SQLite.Net.TableMapping,string,object[])
    [mono-rt] at SQLiteNetExtensions.Extensions.ReadOperations.GetOneToOneChild (SQLite.Net.SQLiteConnection,T,System.Reflection.PropertyInfo,bool,System.Collections.Generic.Dictionary2<string, System.Collections.Generic.Dictionary2<object, object>>)
    [mono-rt] at SQLiteNetExtensions.Extensions.ReadOperations.GetChildRecursive (SQLite.Net.SQLiteConnection,object,System.Reflection.PropertyInfo,bool,System.Collections.Generic.Dictionary2<string, System.Collections.Generic.Dictionary2<object, object>>)
    [mono-rt] at SQLiteNetExtensions.Extensions.ReadOperations.GetChildrenRecursive (SQLite.Net.SQLiteConnection,object,bool,bool,System.Collections.Generic.Dictionary2<string, System.Collections.Generic.Dictionary2<object, object>>)
    [mono-rt] at SQLiteNetExtensions.Extensions.ReadOperations.GetChildren (SQLite.Net.SQLiteConnection,T,bool)
    [mono-rt] at SQLiteNetExtensions.Extensions.ReadOperations.GetAllWithChildren (SQLite.Net.SQLiteConnection,System.Linq.Expressions.Expression1<System.Func2<T, bool>>,bool)
    [mono-rt] at HPservice_APP.Core.CleaningStatusDAO.GetAll () [0x00001] in c:\Users\Usuario\Documents\Projects\HPservice_APP\HPservice_APP.Core\PersistanceLayer\DAO\CleaningStatusDAO.cs:14
    [mono-rt] at HPservice_APP.Core.FilterManager.get_CleaningUIDItems () [0x00010] in c:\Users\Usuario\Documents\Projects\HPservice_APP\HPservice_APP.Core\BusinesslogicLayer\Manager\FilterManager.cs:174
    [mono-rt] at HPservice_APP.Android.RoomInfoDetailFragment.CleaningItemClicked (object,Android.Content.DialogClickEventArgs) [0x00001] in c:\Users\Usuario\Documents\Projects\HPservice_APP\HPservice_APP.Android\Sources\Fragments\RoomInfoDetailFragment.cs:112
    [mono-rt] at Android.Content.IDialogInterfaceOnClickListenerImplementor.OnClick (Android.Content.IDialogInterface,int) [0x0000d] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.20-series/ba9bbbdd/source/monodroid/src/Mono.Android/platforms/android-21/src/generated/Android.Content.IDialogInterface.cs:226
    [mono-rt] at Android.Content.IDialogInterfaceOnClickListenerInvoker.n_OnClick_Landroid_content_DialogInterface_I (intptr,intptr,intptr,int) [0x00011] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.20-series/ba9bbbdd/source/monodroid/src/Mono.Android/platforms/android-21/src/generated/Android.Content.IDialogInterface.cs:180
    [mono-rt] at (wrapper dynamic-method) object.ec373f62-b779-466d-9145-d6e9f36eab48 (intptr,intptr,intptr,int)
    [mono-rt] at (wrapper native-to-managed) object.ec373f62-b779-466d-9145-d6e9f36eab48 (intptr,intptr,intptr,int)
    [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]
    [libc] Fatal signal 11 (SIGSEGV) at 0x61656c43 (code=2), thread 19443 (ice_APP.Android)

  • NatxoNatxoNatxoNatxo ESMember
    edited February 2015

    @RolfBjarneKvinge, I found the solution here:
    https://forums.xamarin.com/discussion/comment/51611/#Comment_51611

    Adding the flag "FullMutex" when I create the SQLiteConnection

    new SQLiteConnection (Path,SQLiteOpenFlags.ReadWrite | SQLiteOpenFlags.Create | SQLiteOpenFlags.FullMutex , true);

    Hope it helps.

  • DnyaneshwarDnyaneshwar USMember ✭✭

    Hi All,
    Same issue with android device and emulator. getting following exception

    [mono-rt] Attempting native Android stacktrace:
    [mono-rt]
    [mono-rt] at android_atomic_dec+16 [0xb6f504f8]
    [mono-rt] at SkPixelRef::globalUnref()+6 [0xb6aab8ff]
    [mono-rt] at SkPaint::setTypeface(SkTypeface)+18 [0xb6ad21c9]
    [mono-rt] at dvmPlatformInvoke+112 [0xb5a6ebcc]
    [mono-rt] at dvmCallJNIMethod(unsigned int const
    , JValue*, Method const*, Thread)+394 [0xb5a9eeff]
    [mono-rt] at dvmCheckCallJNIMethod(unsigned int const
    , JValue*, Method const*, Thread)+8 [0xb5a8973d]
    [mono-rt] at ???+159712 [0xb5a77fe0]
    [mono-rt] at dvmMterpStd(Thread
    )+76 [0xb5a7ef34]
    [mono-rt] at dvmInterpret(Thread*, Method const*, JValue)+184 [0xb5a7c5cc]
    [mono-rt] at dvmCallMethodA(Thread
    , Method const*, Object*, bool, JValue*, jvalue const*)+354 [0xb5ab11ab]
    [mono-rt] at ???+309807 [0xb5a9ca2f]
    [mono-rt] at ???+256183 [0xb5a8f8b7]
    [mono-rt] at ???+127608 [0xa3365278]
    [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]
    [libc] Fatal signal 11 (SIGSEGV) at 0xb6dc78cc (code=2), thread 1395

Sign In or Register to comment.