Search Unity

Unity 2018.1 hard crashing on Android when instantiating an object with a certain component

Discussion in 'Editor & General Support' started by MapMan, May 29, 2018.

  1. MapMan

    MapMan

    Joined:
    Oct 27, 2013
    Posts:
    38
    Hello

    I am upgrading my project from Unity 5.6 to 2018.1. So far, everything seems to work besides some minor issues here and there, mostly from outdated 3rd part assets. The one issue I am battling with is a hard game crash on Android.

    The adb logcat does not give any meaningful information besides the fact that the game process died. Here's how the log looks like after last Unity debug log triggered by my code:

    Code (CSharp):
    1. D/Unity   (11037): (crash) saga icon spawned and initialized: 0 at ./Runtime/Export/Debug.bindings.h:43 (17408, 0, 0)
    2. D/SensorService( 2335):   -0.1 -0.1 9.1
    3. D/SSRMv2:SIOP( 2335): SIOP:: AP = 390, Delta = 10
    4. D/SensorService( 2335):   -0.1 -0.1 9.2
    5. W/InputDispatcher( 2335): channel ~ Consumer closed input channel or an error occurred.  events=0x9
    6. E/InputDispatcher( 2335): channel ~ Channel is unrecoverably broken and will be disposed!
    7. W/InputDispatcher( 2335): Attempted to unregister already unregistered input channel
    8. I/SurfaceFlinger( 1889): Device Built-in Screen -> ls 0
    9. I/WindowState( 2335): WIN DEATH: Window{2264f1e0 u0 com.Foo.Bar/com.unity3d.player.UnityPlayerNativeActivity}
    10. W/WindowManager( 2335): Force-removing child win Window{22612000 u0 SurfaceView} from container Window{2264f1e0 u0 com.Foo.Bar/com.unity3d.player.UnityPlayerNativeActivity}
    11. I/ActivityManager( 2335): Process com.Foo.Bar (pid 11037) (adj 0) has died.
    12. W/ActivityManager( 2335): Force removing ActivityRecord{22525098 u0 com.Foo.Bar/com.unity3d.player.UnityPlayerNativeActivity t11}: app died, no saved state
    13. D/LockPatternUtils( 2532): isPcwEnable = 10
    14. W/ContextImpl( 2335): Calling a method in the system process without a qualified user: android.app.ContextImpl.sendBroadcast:1501 com.android.internal.policy.impl.PhoneWindowManager.notifyToSSRM:6304 com.android.internal.policy.impl.PhoneWindowManager.access$200:195 com.android.internal.policy.impl.PhoneWindowManager$PolicyHandler.handleMessage:766 android.os.Handler.dispatchMessage:102
    15. W/WindowManager( 2335): Failed looking up window
    16. W/WindowManager( 2335): java.lang.IllegalArgumentException: Requested window android.os.BinderProxy@225808f0 does not exist
    17. W/WindowManager( 2335):     at com.android.server.wm.WindowManagerService.windowForClientLocked(WindowManagerService.java:10186)
    18. W/WindowManager( 2335):     at com.android.server.wm.WindowManagerService.windowForClientLocked(WindowManagerService.java:10177)
    19. W/WindowManager( 2335):     at com.android.server.wm.WindowState$DeathRecipient.binderDied(WindowState.java:1522)
    20. W/WindowManager( 2335):     at android.os.BinderProxy.sendDeathNotice(Binder.java:493)
    21. W/WindowManager( 2335):     at dalvik.system.NativeStart.run(Native Method)
    22. D/PointerIcon( 2335): setMouseIconStyle1 pointerType: 1001iconType:101 flag:0
    23. D/PointerIcon( 2335): setMouseCustomIcon IconType is same.101
    24. I/WindowState( 2335): WIN DEATH: null
    25. I/SurfaceFlinger( 1889): Device Built-in Screen -> ls 0
    26. I/SurfaceFlinger( 1889): Device Built-in Screen -> ls 0
    27. I/SurfaceFlinger( 1889): Device Built-in Screen -> ls 0
    28. D/CustomFrequencyManagerService( 2335): acquireDVFSLockLocked : type : DVFS_MIN_LIMIT  frequency : 1600000  uid : 1000  pid : 2335  pkgName : ACTIVITY_RESUME_BOOSTER@5
    29. W/ActivityManager( 2335): mDVFSHelper.acquire()
    30. V/WindowOrientationListener( 2335): ScreenOrientationEventListenerImpl.getProposedRotationLocked, Rotation: -1
    31. V/WindowOrientationListener( 2335): ScreenOrientationEventListenerImpl.getProposedRotationLocked, Rotation: -1
    32. V/WindowManager( 2335): rotationForOrientationLw(orient=-1, last=0); user=2  sensorRotation=-1 mLidState=-1 mDockMode=0 mHdmiPlugged=false mAccelerometerDefault=false gripRotationLock=false
    33. D/SSRMv2:TSP:AirViewOnOff( 2335): SettingsAirViewInfo:: 003000000
    34. D/Launcher( 2672): onRestart, Launcher: 568372016
    35. D/Launcher( 2672): onStart, Launcher: 568372016
    36. D/Launcher.HomeView( 2672): onStart
    37. D/Launcher( 2672): onResume, Launcher: 568372016
    38. D/PhoneStatusBar( 2532): setSemiTransparentMode=false, mTransparentMode=false, mSemiTransparentMode=false, mMultiWindowMode=false
    39. D/Launcher.HomeView( 2672): onResume
    40. D/StatusBarManagerService( 2335): semi p:2672,o:f
    41. D/PhoneStatusBar( 2532): setTransGradationMode=false, mTransparentMode=false, mSemiTransparentMode=false, mMultiWindowMode=false
    42. D/MenuAppsGridFragment( 2672): onResume
    43. D/StatusBarManagerService( 2335): tr p:2672,o:f
    44. V/LvOutput( 1892): initCheck: 0
    45. V/LvOutput( 1892): detachEffects: detach processing for output 2, stream 3, session 41
    46. V/LvOutput( 1892): detachEffects: no output processing was attached to this stream
    47. V/LvOutput( 1892): initCheck: 0
    48. V/LvOutput( 1892): detachEffects: detach processing for output 2, stream 3, session 42
    49. V/LvOutput( 1892): detachEffects: no output processing was attached to this stream
    50. V/AudioPolicyManagerBase( 1892): stopOutput() output 2, stream 3, session 41
    51. V/AudioPolicyManagerBase( 1892): changeRefCount() stream 3, count 1
    52. V/AudioPolicyManagerBase( 1892): releaseOutput() 2
    53. D/Zygote  ( 1890): Process 11037 terminated by signal (11)
    54. V/AudioPolicyManagerBase( 1892): stopOutput() output 2, stream 3, session 42
    55. V/AudioPolicyManagerBase( 1892): changeRefCount() stream 3, count 0
    56. V/AudioPolicyManagerBase( 1892): getNewDevice() selected device 0
    57. V/AudioPolicyManagerBase( 1892): setOutputDevice() output 2 device 0000 force 0 delayMs 170
    58. V/AudioPolicyManagerBase( 1892): setOutputDevice() prevDevice (0002)
    59. V/AudioPolicyManagerBase( 1892): setOutputDevice() setting same device 0000 or null device for output 2
    60. V/AudioPolicyManagerBase( 1892): getOutputsForDevice device 0002 -> 0002
    61. V/AudioPolicyManagerBase( 1892): getOutputsForDevice device 0002 -> 0002
    62. V/AudioPolicyManagerBase( 1892): releaseOutput() 2
    63. I/SurfaceFlinger( 1889): Device Built-in Screen -> ls 0
    64. I/SurfaceFlinger( 1889): Device Built-in Screen -> ls 0
    65. D/STATUSBAR-StatusBarManagerService( 2335): manageDisableList what=0x0 pkg=WindowManager.LayoutParams
    66. D/BarController.StatusBar( 2335): mState: WINDOW_STATE_SHOWING
    67. D/STATUSBAR-StatusBarManagerService( 2335): manageDisableList what=0x0 pkg=WindowManager.LayoutParams
    68. D/ProgramMonitor(11003): LAUNCHER_RESUME
    69. D/ProgramMonitor(11003): isWidgetEnabled:0  mViews:null
    70. V/TaskCloserActivity(11003): TaskCloserActivity onReceive()
    71. W/ContextImpl(11003): Implicit intents with startService are not safe: Intent { act=com.sec.android.app.controlpanel.service.REMOTE_SERVICE } android.content.ContextWrapper.bindService:529 com.sec.android.widgetapp.programmonitorwidget.taskcloser.TaskCloserActivity.onReceive:371 com.sec.android.widgetapp.programmonitorwidget.ProgramMonitorProvider.onReceive:423
    72. D/PointerIcon( 2335): setMouseIconStyle1 pointerType: 1001iconType:101 flag:0
    73. D/PointerIcon( 2335): setMouseCustomIcon IconType is same.101
    74. D/PhoneStatusBar( 2532): Status bar WINDOW_STATE_SHOWING
    75. E/IMGSRV  ( 1889): :0: PVRDRMOpen: TP3, ret = 37
    76. I/SurfaceFlinger( 1889): Device Built-in Screen -> ls 0
    77. I/SurfaceFlinger( 1889): Device Built-in Screen -> ls 0
    78. D/PhoneStatusBar( 2532): setTransGradationMode=false, mTransparentMode=false, mSemiTransparentMode=false, mMultiWindowMode=false
    79. D/StatusBarManagerService( 2335): tr p:2672,o:f
    80. W/ContextImpl( 2335): Calling a method in the system process without a qualified user: android.app.ContextImpl.sendBroadcast:1501 com.android.server.InputMethodManagerService$4.run:2692 java.lang.Thread.run:841 <bottom of call stack> <bottom of call stack>
    81. I/SurfaceFlinger( 1889): Device Built-in Screen -> ls 0
    82. I/SurfaceFlinger( 1889): Device Built-in Screen -> ls 0
    83. W/InputMethodManagerService( 2335): Got RemoteException sending setActive(false) notification to pid 11037 uid 10333
    Because the above log turned out not to be very helpful, I started trying to isolate the issue in my scene. I narrowed it down to a single component on a prefab spawned at runtime. If I remove the component from the prefab, the game does not crash.

    Now here's the crazy part: the aforementioned component is a very basic component that doesn't actually do much. Here's the full code for the component: https://hastebin.com/emakolopej.cs
    The code in Awake isn't even executed as indicated by adb log - the crash happens before Unity invokes the Awake method on it. Moreover, it does not matter if the GameObject that has the component attached is enabled or not - simply instantiating it is enough to crash the game.

    Additionally, I am using the same prefab, with the same components, in other parts of the scene but they are preinstantiated - they are part of the scene at scene load and are not instantiated at runtime. These do not cause any issues.

    The prefab in question is a UI widget, so a GameObject with a RectTransform; always a child of some Canvas.

    Any ideas how to troubleshoot this further? Or maybe somebody is aware of a known bug?
     
  2. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,735
    Looking at the code of that script I don't seen a reason why it crashes.
    Can you report a bug, cause it seems this requires a much deeper investigation.
     
    karl_jones likes this.
  3. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    I think there are some missing parts in this crash. can you post a full log, from the time the app / game is started until the crash (5 seconds after the crash would be better).
     
  4. MapMan

    MapMan

    Joined:
    Oct 27, 2013
    Posts:
    38
    @Aurimas-Cernius The issue went away after updating to Unity 2018.1.2. Probably thanks to this: https://issuetracker.unity3d.com/is...null-value-with-performance-reporting-enabled

    Although, the cause of the crash was different. I pinpointed it to spawning a BaseBehavior (from FullInspector) object at runtime. Even an empty BaseBehaviour component, with no logic in itself was enough to reliably crash the game. I tried creating a repro project but in a fresh project it doesn't crash. Probably something to do with different player settings, services and Android manifest? Anyway, the issue seems to be resolved. Thanks.