Bug 51295 - SIGSEGV at AllocVector
Summary: SIGSEGV at AllocVector
Alias: None
Product: Android
Classification: Xamarin
Component: Mono runtime / AOT Compiler ()
Version: 7.0 (C8)
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Marek Habersack
Depends on:
Reported: 2017-01-09 11:09 UTC by Mikhail Melnik
Modified: 2017-08-22 12:39 UTC (History)
4 users (show)

Tags: XATriaged
Is this bug a regression?: ---
Last known good build:

Sample application which crashes app at some point with SIGSEGV error (8.76 KB, application/x-zip-compressed)
2017-01-10 19:14 UTC, Mikhail Melnik
APK build on current environment and video (4.31 MB, application/x-zip-compressed)
2017-01-11 12:19 UTC, Mikhail Melnik

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 Mikhail Melnik 2017-01-09 11:09:47 UTC
Recently started getting a lot of crashes with stack traces similar to below. There could be many entries but it always ends up with failure at AllocVector. Most of the times it happens after a few calls via ModernHttpClient when there is no connectivity or it is weak.

[Mono] GC_BRIDGE waiting for bridge processing to finish
[mono-rt] Stacktrace:
[mono-rt]   at <unknown> <0xffffffff>
[mono-rt]   at (wrapper managed-to-native) object.__icall_wrapper_mono_gc_alloc_vector (intptr,intptr,intptr) <0x00043>
[mono-rt]   at (wrapper alloc) object.AllocVector (intptr,intptr) <IL 0x0008a, 0x001cf>
[mono-rt]   at System.Collections.Generic.Dictionary`2<System.Linq.Expressions.ParameterExpression, int>.Initialize (int) [0x00007] in /Users/builder/data/lanes/3511/501e63ce/source/mono/mcs/class/referencesource/mscorlib/system/collections/generic/dictionary.cs:313

... Not related stacktrace ...

[mono-rt]   at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback () [0x00000] in /Users/builder/data/lanes/3511/501e63ce/source/mono/mcs/class/referencesource/mscorlib/system/threading/threadpool.cs:1209
[mono-rt]   at (wrapper runtime-invoke) <Module>.runtime_invoke_bool (object,intptr,intptr,intptr) <IL 0x0001f, 0x0007b>
[mono-rt] Attempting native Android stacktrace:
[mono-rt]  at ???+0 [0x6f51e2f0]
[mono-rt]  at ???+0 [0xdead431f]
[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] =================================================================
[libc] Fatal signal 11 (SIGSEGV), code 1, fault addr 0xdead4321 in tid 9456 (Thread-800)

Here is my configuration details:

=== Xamarin Studio Business ===

Version 6.1.3 (build 19)
Installation UUID: f31c63f5-caed-4b21-b062-e7fdfaa690d4
	Microsoft .NET 4.0.30319.42000
	GTK+ 2.24.26 (Light theme)
	GTK# 2.12.38

=== NuGet ===


=== Xamarin.Profiler ===

Not Installed

=== Xamarin.Android ===

Version: (Xamarin Business)
Android SDK: D:\Development\Android\bundle\sdk
	Supported Android versions:
		4.3 (API level 18)
		5.0 (API level 21)
		6.0 (API level 23)
		7.0 (API level 24)

SDK Tools Version: 25.2.4
SDK Platform Tools Version: 25.0.2
SDK Build Tools Version: 25.0.2

Java SDK: C:\Program Files\Java\jdk1.8.0_66
java version "1.8.0_66"
Java(TM) SE Runtime Environment (build 1.8.0_66-b18)
Java HotSpot(TM) 64-Bit Server VM (build 25.66-b18, mixed mode)

Android Designer EPL code available here:

=== Xamarin Android Player ===

Not Installed

=== Build Information ===

Release ID: 601030019
Git revision: 7fabf9293c2d7b638e28a07f798d21799da1f886
Build date: 2016-12-21 07:05:12-05
Xamarin addins: efbae0e683a0060d2230e91e70c1598abc054845
Build lane: monodevelop-windows-cycle8

=== Operating System ===

Windows 10.0.14393.0 (64-bit)
Comment 1 Marek Habersack 2017-01-10 11:07:42 UTC
@Mikhail, is there any chance for a small repro that triggers the segfault? It can be one of two things - either a GC bug or a GC bridge bug, but it's hard to tell without a repro or more detailed stack trace :( Speaking of the latter, is the crash consistently the same as shown above?
Comment 2 Mikhail Melnik 2017-01-10 11:13:32 UTC
@Marek stack trace could be any but it always ends up with the following

[mono-rt] Stacktrace:
[mono-rt]   at <unknown> <0xffffffff>
[mono-rt]   at (wrapper managed-to-native) object.__icall_wrapper_mono_gc_alloc_vector (intptr,intptr,intptr) <0x00043>
[mono-rt]   at (wrapper alloc) object.AllocVector (intptr,intptr) <IL 0x0008a, 0x001cf>

I'll try to reproduce it in a sample app.
Comment 3 Mikhail Melnik 2017-01-10 19:14:31 UTC
Created attachment 19164 [details]
Sample application which crashes app at some point with SIGSEGV error

App crashes on both my devices: Galaxy S3 (Android 4.3) and LG G3 (Android 5.1)
Comment 4 Mikhail Melnik 2017-01-10 19:15:27 UTC
@Marek please let me know if you are able to reproduce crash using sample app.
Comment 5 Marek Habersack 2017-01-11 11:39:06 UTC
@Mikhail, alas (or maybe it's good news? :)) no, I wasn't able to trigger the crash. However, I've been testing with master builds of Xamarin.Android. Can you test your app with the latest Alpha release of Xamarin.Android (https://developer.xamarin.com/releases/current/)? It's quite likely that the issue is already fixed.
Comment 6 Mikhail Melnik 2017-01-11 11:44:42 UTC
@Marek not sure I can play with alpha right now as it is a bit critical for me to keep environment working. Will try to run it on VM in a couple of days.
Comment 7 Marek Habersack 2017-01-11 11:52:42 UTC
@Mikhail, makes perfect sense - please let me know once you will have had the chance to test, thanks!
Comment 8 Mikhail Melnik 2017-01-11 12:19:25 UTC
Created attachment 19221 [details]
APK build on current environment and video

@Marek just to confirm that at least there _was_ an issue I've uploaded apk packaged with my current environment. It takes me less than an minute of frequent clicking on the button on device without internet to crash it. Short video is attached too. Would you be able to try it?
Comment 9 Al Clark [MSFT] 2017-08-22 12:39:06 UTC
Thank you for taking the time to submit this report. After reviewing the description of this bug, we believe it no longer affects the current version of Xamarin.Android. If you are still experiencing the issue after updating your packages, please reopen this report with an attached reproduction.