OnResume First Time After Install Crashes With Fatal Signal 11 (SIGSEGV)

Experiencing a nasty issue where upon first installing our game, backgrounding the game and then coming back in from the launcher icon crashes and restarts the game. This only happens once. After subsequent loads the launcher works fine on resume.

It is particularly a bad problem because we are now unable to track push notification engagement for users that have the game backgrounded.

The seg fault seems to be occurring at libmono.so but I don’t know what the root cause would be.

I am using Unity 4.6.5f1 on the following devices: Nexus 5, Nexus 7 and Galaxy S4

Here is the stack trace:


05-29 10:17:31.253: I/Unity(7631): onResume
05-29 10:17:31.256: V/WindowManager(554): Adding window Window{7368332 u0 com.name.game/com.name.game.CustomUnityPlayerNativeActivity} at 5 of 10 (after Window{bdedfa5 u0 com.name.game/com.name.game.CustomUnityPlayerNativeActivity})
05-29 10:17:31.292: V/WindowManager(554): Adding window Window{3dc7fa00 u0 SurfaceView} at 5 of 11 (before Window{7368332 u0 com.name.game/com.name.game.CustomUnityPlayerNativeActivity})
05-29 10:17:31.300: D/Unity(7631): [EGL] Attaching window 0xb497ea08
05-29 10:17:31.348: I/Unity(7631): windowFocusChanged: true
05-29 10:17:31.363: D/Unity(7631): Acquiring Unity-ProjectRequestedWakeLock
05-29 10:17:31.371: I/ActivityManager(554): Displayed com.name.game/.CustomUnityPlayerNativeActivity: +254ms
05-29 10:17:31.381: D/audio_hw_primary(184): select_devices: out_snd_device(2: speaker) in_snd_device(0: none)
05-29 10:17:31.381: D/ACDB-LOADER(184): ACDB -> send_afe_cal
05-29 10:17:31.381: D/audio_hw_primary(184): enable_snd_device: snd_device(2: speaker)
05-29 10:17:31.381: D/audio_hw_primary(184): --------- beginning of crash
05-29 10:17:31.385: A/libc(7631): Fatal signal 11 (SIGSEGV), code 1, fault addr 0xdc in tid 8009 (UnityMain)
05-29 10:17:31.389: D/audio_hw_primary(184): enable_audio_route: apply and update mixer path: low-latency-playback
05-29 10:17:31.449: I/DEBUG(182): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
05-29 10:17:31.449: I/DEBUG(182): Build fingerprint: 'google/razor/flo:5.1.1/LMY47V/1836172:user/release-keys'
05-29 10:17:31.450: I/DEBUG(182): Revision: '0'
05-29 10:17:31.450: I/DEBUG(182): ABI: 'arm'
05-29 10:17:31.450: I/DEBUG(182): pid: 7631, tid: 8009, name: UnityMain  >>> com.name.game <<<
05-29 10:17:31.450: I/DEBUG(182): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0xdc
05-29 10:17:31.496: I/DEBUG(182):     r0 00000000  r1 a1c8cdb0  r2 00000002  r3 00000000
05-29 10:17:31.496: I/DEBUG(182):     r4 a2fa7c04  r5 9d74d9a8  r6 a1c8c8e8  r7 00000000
05-29 10:17:31.496: I/DEBUG(182):     r8 00000001  r9 b4bdd330  sl 00000072  fp a1c8c84c
05-29 10:17:31.496: I/DEBUG(182):     ip a2fa7e84  sp a1c8c6d8  lr a2e89b58  pc a2c1d01c  cpsr a00f0010
05-29 10:17:31.497: I/DEBUG(182): backtrace:
05-29 10:17:31.497: I/DEBUG(182):     #00 pc 0002301c  /data/app/com.name.game-1/lib/arm/libmono.so (mono_jit_runtime_invoke+160)
05-29 10:17:31.497: I/DEBUG(182):     #01 pc 001fae0c  /data/app/com.name.game-1/lib/arm/libmono.so (mono_runtime_invoke+136)
05-29 10:17:31.497: I/DEBUG(182):     #02 pc 001c932c  /data/app/com.name.game-1/lib/arm/libunity.so (scripting_method_invoke(ScriptingMethodMono, MonoObject*, ScriptingArguments&, MonoException**)+36)
05-29 10:17:31.497: I/DEBUG(182):     #03 pc 0029d84c  /data/app/com.name.game-1/lib/arm/libunity.so (ScriptingInvocation::Invoke(MonoException**, bool)+52)
05-29 10:17:31.497: I/DEBUG(182):     #04 pc 0029d810  /data/app/com.name.game-1/lib/arm/libunity.so (ScriptingInvocation::Invoke(MonoException**)+8)
05-29 10:17:31.497: I/DEBUG(182):     #05 pc 0029323c  /data/app/com.name.game-1/lib/arm/libunity.so (MonoBehaviour::HandleNotifications(void*, int, MessageData&)+292)
05-29 10:17:31.497: I/DEBUG(182):     #06 pc 000de738  /data/app/com.name.game-1/lib/arm/libunity.so (MessageForwarder::HandleMessage(void*, int, MessageData&)+56)
05-29 10:17:31.497: I/DEBUG(182):     #07 pc 000d7ee8  /data/app/com.name.game-1/lib/arm/libunity.so (Unity::GameObject::SendMessageAny(MessageIdentifier const&, MessageData&)+376)
05-29 10:17:31.497: I/DEBUG(182):     #08 pc 00249474  /data/app/com.name.game-1/lib/arm/libunity.so (SendMessageToEveryone(MessageIdentifier, MessageData)+412)
05-29 10:17:31.498: I/DEBUG(182):     #09 pc 00251c8c  /data/app/com.name.game-1/lib/arm/libunity.so (SetPlayerFocus(bool)+220)
05-29 10:17:31.498: I/DEBUG(182):     #10 pc 003be504  /data/app/com.name.game-1/lib/arm/libunity.so (nativeFocusChanged(_JNIEnv*, _jobject*, bool)+68)
05-29 10:17:31.498: I/DEBUG(182):     #11 pc 00500e2b  /data/dalvik-cache/arm/data@app@com.name.game-1@base.apk@classes.dex
05-29 10:17:32.026: I/AudioFlinger(184): BUFFER TIMEOUT: remove(4097) from active list on thread 0xb5928000
05-29 10:17:32.896: W/debuggerd(182): type=1400 audit(0.0:5): avc: denied { read } for name="kgsl-3d0" dev="tmpfs" ino=7653 scontext=u:r:debuggerd:s0 tcontext=u:object_r:gpu_device:s0 tclass=chr_file
05-29 10:17:32.896: W/debuggerd(182): type=1400 audit(0.0:6): avc: denied { read } for name="kgsl-3d0" dev="tmpfs" ino=7653 scontext=u:r:debuggerd:s0 tcontext=u:object_r:gpu_device:s0 tclass=chr_file
05-29 10:17:33.511: E/NativeCrashListener(554): Exception dealing with report
05-29 10:17:33.511: E/NativeCrashListener(554): android.system.ErrnoException: read failed: EAGAIN (Try again)
05-29 10:17:33.511: E/NativeCrashListener(554): 	at libcore.io.Posix.readBytes(Native Method)
05-29 10:17:33.511: E/NativeCrashListener(554): 	at libcore.io.Posix.read(Posix.java:165)
05-29 10:17:33.511: E/NativeCrashListener(554): 	at libcore.io.BlockGuardOs.read(BlockGuardOs.java:230)
05-29 10:17:33.511: E/NativeCrashListener(554): 	at android.system.Os.read(Os.java:350)
05-29 10:17:33.511: E/NativeCrashListener(554): 	at com.android.server.am.NativeCrashListener.consumeNativeCrashData(NativeCrashListener.java:240)
05-29 10:17:33.511: E/NativeCrashListener(554): 	at com.android.server.am.NativeCrashListener.run(NativeCrashListener.java:138)
05-29 10:17:33.656: I/DEBUG(182): Tombstone written to: /data/tombstones/tombstone_01
05-29 10:17:33.660: I/BootReceiver(554): Copying /data/tombstones/tombstone_01 to DropBox (SYSTEM_TOMBSTONE)
05-29 10:17:33.726: I/WindowState(554): WIN DEATH: Window{7368332 u0 com.name.game/com.name.game.CustomUnityPlayerNativeActivity}
  1. Make sure that main activity in manifest, written correctly.
  2. delete duplicate jar file.
  3. try to reomve updates from sdk. (api 22 , api 21)

Hi, are you using plugins? like google play, facebook or Chartboost, try to test without plugins. It seems that the plugin is calling a method when the app is in the background.