Forum Xamarin.iOS

SIGSEGV Error - Garbage Collector

Hello,

I'm working on an iOS App using Xamarin and Azure Mobile Services.

At some point (i'm not sure when), the app started being extremely slow when contacting my API for receiving data, both on device and simulator. I thought it was a matter of Azure throttling me due to my price tier (free, lol). But when I run the API on my computer, the app is just as slow & by timing the API, it showed to be pretty fast on gathering data from the DB and returning it to the APP.

I then started debugging the entire connection (APP side) to Azure and got a SIGSEGV. (The SIGSEGV only appears on my output when I go step by step when performing the connection).

To explain what I'm doing: I have a PCL project that takes care of connecting to the backend. I created my own Delegating Handler to handle authentication:

var handler = new AuthHandler();
MobileService = new MobileServiceClient(Strings.ApiURL, handler);


public class AuthHandler : DelegatingHandler
{
    protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
    {

        //Authorization headers surpressed

        return base.SendAsync(request, cancellationToken);
    }
}

The SIGSEGV happens when stepping in the end of the SendAsync method (after return, at the close bracket):

2017-12-21 11:04:16.494 foo_iOS[8010:1030542] critical: 
Native stacktrace:

2017-12-21 11:04:16.512 foo_iOS[8010:1030542] critical:     0   foo_iOS                      0x0000000107dc9704 mono_handle_native_crash + 244
2017-12-21 11:04:16.512 foo_iOS[8010:1030542] critical:     1   foo_iOS                      0x0000000107dd70a0 mono_sigsegv_signal_handler + 288
2017-12-21 11:04:16.513 foo_iOS[8010:1030542] critical:     2   libsystem_platform.dylib            0x0000000118643f5a _sigtramp + 26
2017-12-21 11:04:16.513 foo_iOS[8010:1030542] critical:     3   ???                                 0x0000000000000000 0x0 + 0
2017-12-21 11:04:16.513 foo_iOS[8010:1030542] critical:     4   foo_iOS                      0x0000000107f1b349 finish_gray_stack + 121
2017-12-21 11:04:16.513 foo_iOS[8010:1030542] critical:     5   foo_iOS                      0x0000000107f1bbe4 major_finish_collection + 132
2017-12-21 11:04:16.513 foo_iOS[8010:1030542] critical:     6   foo_iOS                      0x0000000107f17cb0 major_do_collection + 160
2017-12-21 11:04:16.514 foo_iOS[8010:1030542] critical:     7   foo_iOS                      0x0000000107f1720c sgen_perform_collection + 732
2017-12-21 11:04:16.514 foo_iOS[8010:1030542] critical:     8   foo_iOS                      0x0000000107f18bb3 sgen_gc_collect + 51
2017-12-21 11:04:16.514 foo_iOS[8010:1030542] critical:     9   foo_iOS                      0x0000000107f9d236 _ZL7pump_gcPv + 54
2017-12-21 11:04:16.514 foo_iOS[8010:1030542] critical:     10  libsystem_pthread.dylib             0x00000001186556c1 _pthread_body + 340
2017-12-21 11:04:16.515 foo_iOS[8010:1030542] critical:     11  libsystem_pthread.dylib             0x000000011865556d _pthread_body + 0
2017-12-21 11:04:16.515 foo_iOS[8010:1030542] critical:     12  libsystem_pthread.dylib             0x0000000118654c5d thread_start + 13
2017-12-21 11:04:16.515 foo_iOS[8010:1030542] critical: 
=================================================================
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.
=================================================================

After this happens, the APP freezes for about 5 minutes with threads starting and ending (about 20) on the Application Output and nothing else. When it unfreezes, the method that called the Azure Service works fine, with the object it was receiving being normal.

By looking up on forums I figured out that it has to do with the Garbage Collector. I tried using the concurrent garbage collector on the project options and the same thing happened.
I don't know much about garbage collector and have no idea where to start debugging it to know what's happening, can anyone help me?

Thank you!

Sign In or Register to comment.