Fatal signal 11 (SIGSEGV) when UrhoSurface.OnDestroy() is called - android

I am developing an android app Using UrhoSharp. I have created a SDLSurface as;
surface = UrhoSurface.CreateSurface (this, typeof(UrhoLayer), appOptions);
When I press back button the app crashes after some time. The app seems to crash only when UrhoSurface.OnDestroy() is called. Here is the stacktrace;
[SDL] onDestroy()
[SDL] nativeQuit()
[Mono] [0x7192d4d8] hill climbing, change max number of threads 126
[Mono] DllImport searching in: 'mono-urho' ('libmono-urho.so').
[Mono] Searching for 'TryDeleteRefCounted'.
[Mono] Probing 'TryDeleteRefCounted'.
[Mono] Found as 'TryDeleteRefCounted'.
[Mono] GC_BRIDGE waiting for bridge processing to finish
[Mono] GC_OLD_BRIDGE num-objects 1519 num_hash_entries 1762 sccs size 1762 init 0.00ms df1 5.28ms sort 3.72ms dfs2 1.98ms setup-cb 1.65ms free-data 5.77ms links 421/421/1071/17 dfs passes 3702/2183
[Mono] GC_MAJOR: (user request) pause 41.87ms, total 44.04ms, bridge 0.03ms major 1904K/0K los 180K/0K
Thread started: <Thread Pool> #15
Thread started: <Thread Pool> #16
Thread started: <Thread Pool> #17
[Mono] [0x6e635b30] worker starting
[Mono] [0x6d788a28] worker starting
[Mono] [0x701cf728] worker starting
[Mono] GC_OLD_BRIDGE num-objects 443 num_hash_entries 620 sccs size 620 init 0.00ms df1 3.39ms sort 0.43ms dfs2 1.86ms setup-cb 0.67ms free-data 1.19ms links 319/319/969/17 dfs passes 1382/939
[Mono] GC_MAJOR: (user request) pause 25.58ms, total 25.76ms, bridge 0.00ms major 1808K/0K los 180K/0K
[Mono] DllImport searching in: 'mono-urho' ('libmono-urho.so').
[Mono] Searching for 'RefCounted_ReleaseRef'.
[Mono] Probing 'RefCounted_ReleaseRef'.
[Mono] Found as 'RefCounted_ReleaseRef'.
[mono-rt] Stacktrace:
[mono-rt]
[mono-rt]
[mono-rt] Attempting native Android stacktrace:
[mono-rt]
[mono-rt] at ???+132 [0x597f3084]
[mono-rt] at ???+16380 [0x597f2ffc]
[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 0x597f3084 (code=2), thread 2835 (SDLThread)

Related

mvvmcross xamarin android hangs while loading

I'm using MvvmCross 5.6.3, VS 2017, debugging on Samsung S4.
The splash screen displays "Loading..." but the first ViewModel does not display.
The debug output window shows:
[0:] mvx:Diagnostic: 2.99 Setup: Secondary end
03-01 21:03:44.500 D/Mono (24569): DllImport searching in: '__Internal' ('(null)').
03-01 21:03:44.500 D/Mono (24569): Searching for 'java_interop_jnienv_new_string'.
03-01 21:03:44.500 D/Mono (24569): Probing 'java_interop_jnienv_new_string'.
03-01 21:03:44.500 D/Mono (24569): Found as 'java_interop_jnienv_new_string'.
03-01 21:03:44.500 D/Mono (24569): DllImport searching in: '__Internal' ('(null)').
03-01 21:03:44.500 D/Mono (24569): Searching for 'java_interop_jnienv_get_static_field_id'.
03-01 21:03:44.500 D/Mono (24569): Probing 'java_interop_jnienv_get_static_field_id'.
03-01 21:03:44.500 D/Mono (24569): Found as 'java_interop_jnienv_get_static_field_id'.
03-01 21:03:44.510 D/Mono (24569): DllImport searching in: '__Internal' ('(null)').
03-01 21:03:44.510 D/Mono (24569): Searching for 'java_interop_jnienv_get_static_object_field'.
03-01 21:03:44.510 D/Mono (24569): Probing 'java_interop_jnienv_get_static_object_field'.
03-01 21:03:44.510 D/Mono (24569): Found as 'java_interop_jnienv_get_static_object_field'.
Thread finished: <Thread Pool> #4
The thread 0x4 has exited with code 0 (0x0).
Thread finished: <Thread Pool> #2
and continues creating/finishing threads.
Because of Debug statements I can see that the Initialize method in App.cs completed.
Question:
Are there techniques/tools that will reveal where the code is looping?
Thank you,
Marc

GC_MINOR(Nursery full) Xamarin app crashes

I am new to mobile development and I am trying to make an Xamarin Android app using MVVM framework but I am stuck and getting the following error. I keep getting GC_Minor(Nursary full) entry in my output window and and after a while the it freezes and crashes the application.
Can somebody point me into the right direction on how should I solve this problem? Thank You!!!
Stack
09-20 00:27:30.681 I/art (10052): Explicit concurrent mark sweep GC freed 1775(108KB) AllocSpace objects, 0(0B) LOS objects, 40% free, 18MB/30MB, paused 1.686ms total 49.312ms
09-20 00:27:30.681 D/Mono (10052): GC_TAR_BRIDGE bridges 17 objects 839 opaque 893 colors 17 colors-bridged 17 colors-visible 17 xref 1 cache-hit 0 cache-semihit 0 cache-miss 0 setup 0.15ms tarjan 1.27ms scc-setup 0.13ms gather-xref 0.01ms xref-setup 0.00ms cleanup 0.08ms
09-20 00:27:30.681 D/Mono (10052): GC_BRIDGE: Complete, was running for 51.29ms
09-20 00:27:30.681 D/Mono (10052): GC_MINOR: (Nursery full) time 9.80ms, stw 11.54ms promoted 106K major size: 7600K in use: 6910K los size: 2048K in use: 956K
09-20 00:27:32.626 D/Mono (10052): GC_TAR_BRIDGE bridges 0 objects 0 opaque 0 colors 0 colors-bridged 0 colors-visible 17 xref 1 cache-hit 0 cache-semihit 0 cache-miss 0 setup 0.15ms tarjan 1.27ms scc-setup 0.13ms gather-xref 0.01ms xref-setup 0.00ms cleanup 0.01ms
09-20 00:27:32.626 D/Mono (10052): GC_BRIDGE: Complete, was running for 0.19ms
09-20 00:27:32.626 D/Mono (10052): GC_MINOR: (Nursery full) time 7.97ms, stw 10.12ms promoted 99K major size: 7712K in use: 7010K los size: 2048K in use: 956K
09-20 00:27:34.511 D/Mono (10052): GC_TAR_BRIDGE bridges 0 objects 0 opaque 0 colors 0 colors-bridged 0 colors-visible 17 xref 1 cache-hit 0 cache-semihit 0 cache-miss 0 setup 0.15ms tarjan 1.27ms scc-setup 0.13ms gather-xref 0.01ms xref-setup 0.00ms cleanup 0.01ms
09-20 00:27:34.511 D/Mono (10052): GC_BRIDGE: Complete, was running for 0.20ms
09-20 00:27:34.511 D/Mono (10052): GC_MINOR: (Nursery full) time 7.81ms, stw 9.15ms promoted 99K major size: 7808K in use: 7110K los size: 2048K in use: 956K
09-20 00:27:36.426 D/Mono (10052): GC_TAR_BRIDGE bridges 0 objects 0 opaque 0 colors 0 colors-bridged 0 colors-visible 17 xref 1 cache-hit 0 cache-semihit 0 cache-miss 0 setup 0.15ms tarjan 1.27ms scc-setup 0.13ms gather-xref 0.01ms xref-setup 0.00ms cleanup 0.01ms
09-20 00:27:36.426 D/Mono (10052): GC_BRIDGE: Complete, was running for 0.19ms
09-20 00:27:36.426 D/Mono (10052): GC_MINOR: (Nursery full) time 7.62ms, stw 8.94ms promoted 99K major size: 7920K in use: 7210K los size: 2048K in use: 956K
An unhandled exception occured.
Update
09-19 07:26:01.242 E/mono (14051):
09-19 07:26:01.242 E/mono (14051): Unhandled Exception:
09-19 07:26:01.242 E/mono (14051): System.ArgumentNullException: Value cannot be null.
09-19 07:26:01.242 E/mono (14051): Parameter name: s
09-19 07:26:01.242 E/mono-rt (14051): [ERROR] FATAL UNHANDLED EXCEPTION: System.ArgumentNullException: Value cannot be null.
09-19 07:26:01.242 E/mono-rt (14051): Parameter name: s
referenceTable GDEF length=814 1
referenceTable GSUB length=11364 1
referenceTable GPOS length=47302 1
referenceTable head length=54 1
referenceTable GDEF length=808 1
referenceTable GSUB length=11364 1
referenceTable GPOS length=49128 1
referenceTable head length=54 1
referenceTable GDEF length=808 1
referenceTable GSUB length=11364 1
referenceTable GPOS length=49206 1
referenceTable head length=54 1
referenceTable GDEF length=814 1
referenceTable GSUB length=11364 1
referenceTable GPOS length=47476 1
referenceTable head length=54 1
So after the GC_Minor warnings I get this unhandled exception. I updated xamarin a week ago to lastest version, does this have to do anything with the error I'm getting?

Does the Visual Studio emulator for Android support OpenGL ES 3.0?

I develped an OpenGL ES 3.0 app with Xamarin.Android. It runs well on my phone but crashed on the VS emulator for Android.
It crashes here:
at (wrapper managed-to-native) OpenTK.Graphics.ES30.GL/Core.CreateShader (OpenTK.Graphics.ES30.All) <0x00012>
And an error occurs before:
E/EGL_emulation( 1977): tid 1977: eglGetConfigAttrib(606): error 0x3004 (EGL_BAD_ATTRIBUTE)
I wonder if the simluator doesn't support OpenGL ES 3.0.
In the OpenGL ES Support section of this post,
VS Emulator for Android can now render apps that make use of OpenGL ES up to version 2.0
So, does the Visual Studio emulator for Android support OpenGL ES 3.0?
related logs:
D/Mono ( 1977): Found as 'java_interop_jnienv_get_object_array_element'.
E/EGL_emulation( 1977): [getAttribValue] Bad attribute idx
E/EGL_emulation( 1977): tid 1977: eglGetConfigAttrib(606): error 0x3004 (EGL_BAD_ATTRIBUTE)
D/Mono ( 1977): DllImport searching in: '__Internal' ('(null)').
D/Mono ( 1977): Searching for 'java_interop_jnienv_get_field_id'.
D/Mono ( 1977): Probing 'java_interop_jnienv_get_field_id'.
D/Mono ( 1977): Found as 'java_interop_jnienv_get_field_id'.
D/Mono ( 1977): DllImport searching in: '__Internal' ('(null)').
D/Mono ( 1977): Searching for 'java_interop_jnienv_get_int_field'.
D/Mono ( 1977): Probing 'java_interop_jnienv_get_int_field'.
D/Mono ( 1977): Found as 'java_interop_jnienv_get_int_field'.
D/Mono ( 1977): Assembly Ref addref Xamarin.OpenGL[0xb42b90a0] -> System[0x9e581dc0]: 4
D/Mono ( 1977): Assembly Ref addref Xamarin.OpenGL[0xb42b90a0] -> System.Core[0x9d8b71c0]: 4
Resolved pending breakpoint at 'ShaderProgram.cs:27,1' to void CSharpGLES.ShaderProgram.Create (string vertexShaderSource, string fragmentShaderSource, System.Collections.Generic.Dictionary<int,string> attributeLocations) [0x00001].
D/Mono ( 1977): DllImport attempting to load: 'GLESv2'.
D/Mono ( 1977): DllImport error loading library './libGLESv2': 'dlopen failed: library "/data/app/Xamarin.OpenGL.Xamarin.OpenGL-1/lib/x86/./libGLESv2" not found'.
D/Mono ( 1977): DllImport loaded library './libGLESv2.so'.
D/Mono ( 1977): DllImport searching in: 'GLESv2' ('./libGLESv2.so').
D/Mono ( 1977): Searching for 'glCreateShader'.
E/mono-rt ( 1977): Stacktrace:
E/mono-rt ( 1977):
E/mono-rt ( 1977): at <unknown> <0xffffffff>
E/mono-rt ( 1977): at (wrapper managed-to-native) OpenTK.Graphics.ES30.GL/Core.CreateShader (OpenTK.Graphics.ES30.All) <0x00012>
E/mono-rt ( 1977): at OpenTK.Graphics.ES30.GL.CreateShader (OpenTK.Graphics.ES30.All) [0x00002] in /Users/builder/data/lanes/4009/9578cdcd/source/monodroid/src/OpenGLES/OpenTK/Graphics/ES30.Android/GL.cs:1559
Related:
Does the Android Emulator support OpenGL ES 2.0?
Does the Android emulator support OpenGL ES 3.0?
Someone has found the answer for me: OpenGLES 3.0 hasn't been supported.
from https://blogs.msdn.microsoft.com/visualstudioalm/2015/02/23/the-visual-studio-emulator-for-android-in-vs2015-ctp6/
... the VS Emulator for Android can now render apps that make use of OpenGL ES > up to version 2.0. .... (If you’re curious, under the hood we’re forwarding
OpenGL ES calls to the host machine’s GPU and using ANGLE to translate the
calls to DirectX).
from ANGLE (https://chromium.googlesource.com/angle/angle/+/master/README.md)
still not fully support GLES3.0 (in progress).
so It may cause the error on shader compilation on the emulator.
Update:
A staff member of MS told me in another site that the driver of the emulator hasn't supported OpenGLES 3.0. So currently the emulator won't support OpenGL ES 3.0 even if ANGLE does support.

Android(mono), TypeLoadException : " Could not load type 'CameraInfo' "

I used the below code piece to read barcode using Zxing barcode library which is downloaded from http://components.xamarin.com/gettingstarted/zxing.net.mobile. Application minVersion is selected as 2.3 and target version is selected as Automatic. I'am running the app on nexus 4 (Android 4.4.2)
BarcodeButton.Click += async delegate
{
var scanner = new ZXing.Mobile.MobileBarcodeScanner(this);
var result = await scanner.Scan();
if (result != null)
Toast.MakeText(this,"DONE",ToastLength.Short).Show();
};
When I run the application, after pressing the barcodebutton this error log is obtained. What is the error? How can I solve it? :
...
[Mono] Assembly Ref addref ZXing.Net.Mobile[0x784bb038] -> mscorlib[0x777e2a10]: 9
[Mono] Assembly Ref addref TeleLib[0x784b8c58] -> zxing.monoandroid[0x784ba440]: 2
[Mono] The request to load the assembly mscorlib v2.0.5.0 was remapped to v2.0.0.0
[Mono] Unloading image mscorlib.dll [0x78801068].
[Mono] Assembly Ref addref zxing.monoandroid[0x784ba440] -> mscorlib[0x777e2a10]: 10
[Mono] Assembly Ref addref ZXing.Net.Mobile[0x784bb038] -> Mono.Android[0x784bbb98]: 4
[Mono] Assembly Ref addref ZXing.Net.Mobile[0x784bb038] -> zxing.monoandroid[0x784ba440]: 3
[Mono] Assembly Ref addref ZXing.Net.Mobile[0x784bb038] -> Xamarin.Android.Support.v4[0x784b9848]: 2
[Mono] Assembly Ref addref zxing.monoandroid[0x784ba440] -> Mono.Android[0x784bbb98]: 5
[] TypeRef ResolutionScope not yet handled (14) for .CameraInfo in image /data/data/TeleLib.TeleLib/files/.__override__/ZXing.Net.Mobile.dll
[Mono] The class CameraInfo could not be loaded, used in
[MonoDroid] UNHANDLED EXCEPTION: System.TypeLoadException: Could not load type 'CameraInfo'.
[MonoDroid] at Android.Views.ISurfaceHolderCallbackInvoker.n_SurfaceCreated_Landroid_view_SurfaceHolder_ (intptr,intptr,intptr) <0x0005f>
[MonoDroid] at (wrapper dynamic-method) object.c17a61df-f7d9-45dc-ba1c-dac5c5d9eb39 (intptr,intptr,intptr) <0x00043>
[mono]
[mono] Unhandled Exception:
[mono] System.TypeLoadException: Could not load type 'CameraInfo'.
[mono] at Android.Views.ISurfaceHolderCallbackInvoker.n_SurfaceCreated_Landroid_view_SurfaceHolder_ (IntPtr jnienv, IntPtr native__this, IntPtr native_holder) [0x00000] in <filename unknown>:0
[mono] at (wrapper dynamic-method) object:c17a61df-f7d9-45dc-ba1c-dac5c5d9eb39 (intptr,intptr,intptr)
[mono-rt] [ERROR] FATAL UNHANDLED EXCEPTION: System.TypeLoadException: Could not load type 'CameraInfo'.
[mono-rt] at Android.Views.ISurfaceHolderCallbackInvoker.n_SurfaceCreated_Landroid_view_SurfaceHolder_ (IntPtr jnienv, IntPtr native__this, IntPtr native_holder) [0x00000] in <filename unknown>:0
[mono-rt] at (wrapper dynamic-method) object:c17a61df-f7d9-45dc-ba1c-dac5c5d9eb39 (intptr,intptr,intptr)
I was running into the same issue and figured out that the ZXing.NET component requires Android version 2.3. Change your project to target 2.3 or newer, and this error will go away.

Monodroid - GC.Collect fails without any reason

I have an application with 4 tabs (TabActivity). By some reasons I call GC.Collect every time user switches tab (overriding OnPause Activity's method). Sometimes (approximately 1 time from 50-100 calls, but sometimes this happens when application just started) my application hangs in this moment.
Here is part of my code:
protected override void OnPause(){
base.OnPause();
try{
Android.Util.Log.Info("----","GC.Collect(GC.MaxGeneration, GCCollectionMode.Forced);");
GC.Collect(GC.MaxGeneration, GCCollectionMode.Forced);
Android.Util.Log.Info("----","GC.Collect Finished");
}catch(Exception exc){
Android.Util.Log.Info("exc.Message",exc.Message);
Android.Util.Log.Info("exc.StackTrace",exc.StackTrace);
throw exc;
}
}
And here is corresponding Android log output
//Previous GC.Collect call, it's all ok
I/---- ( 7796): GC.Collect(GC.MaxGeneration, GCCollectionMode.Forced);
D/dalvikvm( 7796): GetMethodID: method not found: Landroid/widget/EditText;.monodroidAddReference:(Ljava/lang/Object;)V
D/dalvikvm( 7796): GC_EXPLICIT freed 962 objects / 42472 bytes in 112ms
I/---- ( 7796): GC.Collect Finished
//On another call fails
I/---- ( 7796): GC.Collect(GC.MaxGeneration, GCCollectionMode.Forced);
I/mono ( 7796): Stacktrace:
I/mono ( 7796):
I/mono ( 7796): at System.GC.Collect (int) <0x0001f>
I/mono ( 7796): at System.GC.Collect (int,System.GCCollectionMode) <0x00017>
I/mono ( 7796): at PixelsAndroid.CustomActivity.OnPause () <0x00067>
I/mono ( 7796): at Android.App.Activity.n_OnPause (intptr,intptr) <0x00037>
I/mono ( 7796): at (wrapper dynamic-method) object.908cefd4-40eb-4dd1-97cd-f731b2ada74a (intptr,intptr) <0x0002b>
I/mono ( 7796): at (wrapper native-to-managed) object.908cefd4-40eb-4dd1-97cd-f731b2ada74a (intptr,intptr) <0xffffffff>
No any exception to been thrown, no any visible reason to fail. Application just hangs, after few seconds I get Android OS alert: "Oppps, your application got stuck. Force close or wait?"
Anybody faced with it?
There was a bug in some old versions of monodroid: if you call GC.Collect and an http request in a parallel threads, this caused crash. Update to a latest version of monodroid.
Having to do a GC.Collect() under any circumstance is a bad code smell. Figure out the underlying reason and perform corrective rearchitecture.

Categories

Resources