Bug 16765 - SIGSEGV FocusMonoTouch_ObjCRuntime_Trampolines_SDALAssetsLibraryAssetForURLResultDelegate_Invoke_intptr_intptr
Summary: SIGSEGV FocusMonoTouch_ObjCRuntime_Trampolines_SDALAssetsLibraryAssetForURLRe...
Alias: None
Product: iOS
Classification: Xamarin
Component: General ()
Version: 7.0.4.x
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2013-12-12 19:43 UTC by Alexey Sednev
Modified: 2016-05-24 20:54 UTC (History)
3 users (show)

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:

Description Alexey Sednev 2013-12-12 19:43:18 UTC
I have an app that is loading a large number of pictures from the photo gallery using ALAssetsLibrary API. Initially, it was crashing with a large number of images. I increased a number of trampolines to 4096 with the args:

-aot "nrgctx-trampolines=4096" -aot "nimt-trampolines=4096" -aot "ntrampolines=4096"

Yet, I am still seeing occasional crashes on a library of about 1000 images. Any suggestions? I want the app to be able to handle an unlimited number of images in the library. I can't go one raising the number of trampolines forever.

0	Focus	0x0012b69a	testflight_backtrace
1	Focus	0x0012acfe	TFSignalHandler
2	libsystem_platform.dylib	0x3a2e8722	_sigtramp
3	Focus	0x0016b7fb	MonoTouch_ObjCRuntime_Trampolines_SDALAssetsLibraryAssetForURLResultDelegate_Invoke_intptr_intptr
4	Focus	0x0016b7fb	MonoTouch_ObjCRuntime_Trampolines_SDALAssetsLibraryAssetForURLResultDelegate_Invoke_intptr_intptr
5	Focus	0x0018456b	wrapper_native_to_managed_MonoTouch_ObjCRuntime_Trampolines_SDALAssetsLibraryAssetForURLResultDelegate_Invoke_intptr_intptr
6	AssetsLibrary	0x2f13583e	__56-[ALAssetsLibrary assetForURL:resultBlock:failureBlock:]_block_invoke_2
7	libdispatch.dylib	0x3a1bb102	_dispatch_call_block_and_release
8	libdispatch.dylib	0x3a1bb0ee	_dispatch_client_callout
9	libdispatch.dylib	0x3a1bd9a8	_dispatch_main_queue_callback_4CF
11	CoreFoundation	0x2f9a5e84	__CFRunLoopRun
12	CoreFoundation	0x2f910540	CFRunLoopRunSpecific
13	CoreFoundation	0x2f910322	CFRunLoopRunInMode
14	GraphicsServices	0x346472ea	GSEventRunModal
15	UIKit	0x321c71e4	UIApplicationMain
16	Focus	0x001839ff	wrapper_managed_to_native_MonoTouch_UIKit_UIApplication_UIApplicationMain_int_string___intptr_intptr
17	Focus	0x00157917	MonoTouch_UIKit_UIApplication_Main_string___string_string
18	Focus	0x00131daf	Focus.Application:Main in xdb.il on Line 1
19	Focus	0x0023b57f	wrapper_runtime_invoke_object_runtime_invoke_dynamic_intptr_intptr_intptr_intptr
20	Focus	0x002da740	mono_jit_runtime_invoke in mini.c on Line 6504
21	Focus	0x0032211c	mono_runtime_invoke in object.c on Line 2827
22	Focus	0x00325eac	mono_runtime_exec_main in object.c on Line 4054
23	Focus	0x00325cec	mono_runtime_run_main in object.c on Line 3678
24	Focus	0x002c4ad8	mono_jit_exec in driver.g.c on Line 962
25	Focus	0x0036ba03	main in main.m on Line 486
26	libdyld.dylib	0x3a1cfab6	start
Comment 1 Sebastien Pouliot 2013-12-12 19:58:06 UTC
-aot "nrgctx-trampolines=4096" -aot "nimt-trampolines=4096" -aot

^ those parameters are not used in recent version of Xamarin.iOS. The number of trampolines are automatically adjusted.

Can you give us a test case (we can supply the images but we need to see your code) ?

Also tell us on about the software version you're using* and the iOS version(s) and devices you used.

* The easiest way to get exact version information is to use the "Xamarin Studio" menu, "About Xamarin Studio" item, "Show Details" button and copy/paste the version informations (you can use the "Copy Information" button).
Comment 2 Alexey Sednev 2013-12-13 19:48:24 UTC
Nonetheless, before I plugged those parameters, my app was crashing immediately once ran on a phone with about 1000 images. Now, it's only crashing sometimes.

I will work on separating the code around ALAssetsLibrary. I will submit the code in a few days.

And here's the snippet from About Xamarin Studio:

=== Xamarin Studio ===

Version 4.2.2 (build 2)
Installation UUID: 06dba93e-1d37-4acf-90bb-a7f681abc781
	Mono 3.2.5 ((no/964e8f0)
	GTK+ 2.24.20 theme: Raleigh
	GTK# (
	Package version: 302050000

=== Xamarin.Android ===

Not Installed

=== Apple Developer Tools ===

Xcode 5.0.2 (3335.32)
Build 5A3005

=== Xamarin.iOS ===

Version: (Indie Edition)
Hash: 23a0827
Build date: 2013-11-11 16:04:00-0500

=== Xamarin.Mac ===

Xamarin.Mac: Not Installed

=== Build Information ===

Release ID: 402020002
Git revision: c5f82958ae7d9af652b44b87ceff777b3ad19b91
Build date: 2013-11-19 15:35:40+0000
Xamarin addins: a4044fee09138f6fd031a9944b7caaeb51e57e80

=== Operating System ===

Mac OS X 10.9.0
Darwin MMs-MacBook-Pro.local 13.0.0 Darwin Kernel Version 13.0.0
    Thu Sep 19 22:22:27 PDT 2013
    root:xnu-2422.1.72~6/RELEASE_X86_64 x86_64
Comment 3 Alexey Sednev 2013-12-26 19:54:08 UTC
Here's the test case as requested https://github.com/asednev/iOS-ImagePicker
Comment 4 Rolf Bjarne Kvinge [MSFT] 2014-01-06 07:43:00 UTC
What do I need to do to reproduce the crash? I ran the test project on an iPad Air and tapped/ticked all the images shown - is there anything else I need to do?
Comment 5 Alexey Sednev 2014-01-06 07:57:59 UTC
You need to have 1000+ images on the device. At that point the app will crash without you doing anything. I didn't try iPad Air but the app did crash every single time on on iPhone 4, iPhone 5, and iPhone 5S.
Comment 6 Rolf Bjarne Kvinge [MSFT] 2014-01-06 10:34:22 UTC
1900 images on an iPad Air did not crash.

I'll try on an older device and see if that changes anything.
Comment 7 Rolf Bjarne Kvinge [MSFT] 2014-01-07 12:17:08 UTC
4259 images on an iPhone 5 didn't crash either (both of these devices have iOS 7.1 installed).

Can you try profiling with Instruments to see if it's a memory problem? Are you getting memory warnings before the app crashes? It could also be useful to view a crash report from Xcode's Organizer.
Comment 8 Alexey Sednev 2014-01-08 08:29:31 UTC
Rolf, thank you for your suggestions. I will keep analyzing this issue. I will let you know what I find out. I didn't see crash reports on this issue in a few weeks. I wonder if it could have been an update to Xamarin.iOS that fixed it.

One more thing to clarify - when you ran the app on a phone with 1900 images (or 4259), did you try to actually scroll through these images?
Comment 9 Rolf Bjarne Kvinge [MSFT] 2014-01-08 09:09:00 UTC
No, I did not try scrolling much.
Comment 10 Sebastien Pouliot 2016-05-24 20:54:32 UTC
We have not received the requested information. If you are still experiencing this issue please provide all the requested information and re-open the bug report. Thanks!