Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

[Unity 2017.3.1f1] Importing IAP introduces game breaking bug

Discussion in 'Unity IAP' started by ph4ntomz, Feb 6, 2019.

  1. ph4ntomz

    ph4ntomz

    Joined:
    Jul 22, 2016
    Posts:
    19
    Hi guys,

    I am quite desperately looking for an answer to my problem, but fail to do so for hours. Recently I stumbled upon a game breaking bug in my latest build. When the player touches the screen quickly with multiple fingers, the game crashes.

    After hours of going through my builds, I pinned down the problem to the Unity IAP. The last version working did not have the Unity IAP imported to the project. Once I do that, the game breaking bug is introduced, as well. It does not even matter, whether I reference any of the IAP logic or not. Just importing the package via the service tab results in the bug.

    This is the error, which I got from monitoring the game via LogCat:
    Code (csharp):
    1.  
    2. 02-06 16:11:21.643: E/CRASH(21886): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000000
    3. 02-06 16:11:21.643: E/CRASH(21886): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
    4. 02-06 16:11:21.643: E/CRASH(21886): Build fingerprint: 'samsung/heroltexx/herolte:8.0.0/R16NW/G930FXXS3ERL4:user/release-keys'
    5. 02-06 16:11:21.643: E/CRASH(21886): Revision: '8'
    6. 02-06 16:11:21.643: E/CRASH(21886): pid: 21886, tid: 21903, name: UnityMain  >>> com.test.bunjes <<<
    7. 02-06 16:11:21.643: E/CRASH(21886):     r0 00000000  r1 00000000  r2 ffffffff  r3 ffffffff
    8. 02-06 16:11:21.643: E/CRASH(21886):     r4 ccedbc10  r5 cfdfe954  r6 f2693e40  r7 00000000
    9. 02-06 16:11:21.643: E/CRASH(21886):     r8 00000000  r9 d2541a40  sl d2541a40  fp cfdfe4e8
    10. 02-06 16:11:21.643: E/CRASH(21886):     ip cfdfe4a8  sp cfdfe4e8  lr 00000000  pc c91747c8  cpsr 0000004d
    11. 02-06 16:11:21.643: E/CRASH(21886): backtrace:
    12. 02-06 16:11:21.645: E/CRASH(21886):     #00  pc 000397c8   ( InputController:Update () + 0xdd8 (0xc91739f0 0xc9174b70) [0xf26dcee0 - Unity Root Domain]+235464)
    13. 02-06 16:11:21.645: E/CRASH(21886): stack:
    14. 02-06 16:11:21.645: E/CRASH(21886):          cfdfe4a8  0000101e
    15. 02-06 16:11:21.645: E/CRASH(21886):          cfdfe4ac  c3c6ea34  [anon:libc_malloc]
    16. 02-06 16:11:21.645: E/CRASH(21886):          cfdfe4b0  c3c6ea30  [anon:libc_malloc]
    17. 02-06 16:11:21.645: E/CRASH(21886):          cfdfe4b4  ffffffff
    18. 02-06 16:11:21.645: E/CRASH(21886):          cfdfe4b8  cfce87e0
    19. 02-06 16:11:21.645: E/CRASH(21886):          cfdfe4bc  d2541a40  [anon:.bss]
    20. 02-06 16:11:21.645: E/CRASH(21886):          cfdfe4c0  00000000
    21. 02-06 16:11:21.645: E/CRASH(21886):          cfdfe4c4  cfdfe4d0
    22. 02-06 16:11:21.645: E/CRASH(21886):          cfdfe4c8  cfdfe4d0
    23. 02-06 16:11:21.645: E/CRASH(21886):          cfdfe4cc  f234bcac
    24. 02-06 16:11:21.645: E/CRASH(21886):          cfdfe4d0  0000101e
    25. 02-06 16:11:21.645: E/CRASH(21886):          cfdfe4d4  f1ebb8a0
    26. 02-06 16:11:21.645: E/CRASH(21886):          cfdfe4d8  00000000
    27. 02-06 16:11:21.645: E/CRASH(21886):          cfdfe4dc  cfdfe4e8
    28. 02-06 16:11:21.645: E/CRASH(21886):          cfdfe4e0  cfdfe4e8
    29. 02-06 16:11:21.645: E/CRASH(21886):          cfdfe4e4  c9174794
    30. 02-06 16:11:21.645: E/CRASH(21886):     #00  cfdfe4e8  c89dfcc0
    31. 'samsung/heroltexx/herolte:8.0.0/R16NW/G930FXXS3ERL4:user/release-keys'
    32. 02-06 16:11:21.649: E/AndroidRuntime(21886): Revision: '8'
    33. 02-06 16:11:21.649: E/AndroidRuntime(21886): pid: 21886, tid: 21903, name: UnityMain  >>> com.test.bunjes <<<
    34. 02-06 16:11:21.649: E/AndroidRuntime(21886):     r0 00000000  r1 00000000  r2 ffffffff  r3 ffffffff
    35. 02-06 16:11:21.649: E/AndroidRuntime(21886):     r4 ccedbc10  r5 cfdfe954  r6 f2693e40  r7 00000000
    36. 02-06 16:11:21.649: E/AndroidRuntime(21886):     r8 00000000  r9 d2541a40  sl d2541a40  fp cfdfe4e8
    37. 02-06 16:11:21.649: E/AndroidRuntime(21886):     ip cfdfe4a8  sp cfdfe4e8  lr 00000000  pc c91747c8  cpsr 0000004d
    38. 02-06 16:11:21.649: E/AndroidRuntime(21886):     at Unknown.000397c8(Unknown Source:0)
    39.  
    40.  
    This is the InputController.Update, which is mentioned in the error:
    Code (CSharp):
    1. void Update() {
    2.         #if UNITY_EDITOR || UNITY_STANDALONE_WIN
    3.         if (Input.GetMouseButtonDown(0)) {
    4.             //Array.Clear(m_hitResults, 0, m_hitResultLength);
    5.             m_hitAmount = Physics2D.RaycastNonAlloc(m_mainCamera.ScreenToWorldPoint(Input.mousePosition), Vector2.zero, m_hitResults);
    6.             if(m_hitAmount > 0) {
    7.                 m_touchableCache = GetTouchableFromDictionary (m_hitResults[0].collider.gameObject.GetInstanceID ());
    8.                 if (m_touchableCache != null) {
    9.                     if(showDebug) {                      
    10.                         Debug.Log("KB: Began click on: " + m_touchableCache.GetName());
    11.                     }
    12.                     m_touchableCache.OnTouchBegan ();
    13.                     m_lastTouchable = m_touchableCache;
    14.                 }
    15.             }
    16.         }
    17.         if(Input.GetMouseButtonUp(0)) {          
    18.             m_hitAmount = Physics2D.RaycastNonAlloc(m_mainCamera.ScreenToWorldPoint(Input.mousePosition), Vector2.zero, m_hitResults);
    19.  
    20.             if(showDebug) {
    21.                 for(int i = 0; i < m_hitAmount; i++) {
    22.                     Debug.Log("KB: " + m_hitResults[i].collider.name);
    23.                 }
    24.                 Debug.Log("KB: - - - - - -");
    25.             }
    26.  
    27.             if (m_hitAmount > 0) {
    28.                 m_touchableCache = GetTouchableFromDictionary (m_hitResults[0].collider.gameObject.GetInstanceID ());
    29.  
    30.                 if (m_touchableCache != null) {
    31.                     if(showDebug) {
    32.                         Debug.Log("KB: Ended click on: " + m_touchableCache.GetName());
    33.                     }
    34.                     if (m_lastTouchable != null) {
    35.                         if (m_touchableCache.GetInstanceID () == m_lastTouchable.GetInstanceID ()) {
    36.                             m_touchableCache.OnTouchEnded ();
    37.                             m_lastTouchable = null;
    38.                         } else {
    39.                             if(showDebug) {
    40.                                 Debug.Log("KB: Ended outside from: " + m_touchableCache.GetName());
    41.                             }
    42.                             m_lastTouchable.OnTouchEndedOutside ();
    43.                             m_lastTouchable = null;
    44.                         }
    45.                     }
    46.                 }
    47.             }
    48.         }
    49.         #endif
    50.  
    51.  
    52.         if (Input.touchCount > 0) {
    53.             Debug.Log ("KB: touching...");
    54.             if (Input.GetTouch (0).phase == TouchPhase.Began) {
    55.                 Array.Clear(m_hitResults, 0, m_hitResultLength);
    56.                 m_hitAmount = Physics2D.RaycastNonAlloc(m_mainCamera.ScreenToWorldPoint(Input.mousePosition), Vector2.zero, m_hitResults);
    57.                 if(m_hitAmount > 0) {
    58.                     m_touchableCache = GetTouchableFromDictionary (m_hitResults[0].collider.gameObject.GetInstanceID ());
    59.                     if (m_touchableCache != null) {                      
    60.                         if(showDebug) {
    61.                             Debug.Log("Began touch on: " + m_touchableCache.GetName());
    62.                         }
    63.                         m_touchableCache.OnTouchBegan ();
    64.                         m_lastTouchable = m_touchableCache;
    65.                     }
    66.                 }
    67.  
    68.             } else if(Input.GetTouch (0).phase == TouchPhase.Ended) {
    69.                 Array.Clear(m_hitResults, 0, m_hitResultLength);
    70.                 m_hitAmount = Physics2D.RaycastNonAlloc(m_mainCamera.ScreenToWorldPoint(Input.mousePosition), Vector2.zero, m_hitResults);
    71.                 if (m_hitAmount > 0) {
    72.                     m_touchableCache = GetTouchableFromDictionary (m_hitResults[0].collider.gameObject.GetInstanceID ());
    73.                     if (m_touchableCache != null) {
    74.                         if(showDebug) {
    75.                             Debug.Log("Ended touch on: " + m_touchableCache.GetName ());
    76.                         }
    77.                         if (m_touchableCache.GetInstanceID () == m_lastTouchable.GetInstanceID ()) {
    78.                             m_touchableCache.OnTouchEnded ();
    79.                             m_lastTouchable = null;
    80.                         } else {
    81.                             if(showDebug) {
    82.                                 Debug.Log("Ended outside from: " + m_touchableCache.GetName ());
    83.                             }
    84.                             m_lastTouchable.OnTouchEndedOutside ();
    85.                             m_lastTouchable = null;
    86.                         }
    87.                     }
    88.                 }
    89.             }
    90.         }
    91.     }
    To me, this seems really random. I have absolutely no clue, why this is happening. Looking for the error (java.lang.Error: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000000)
    results in nothing useful. Unity has closed the thread regarding this error occuring as "Cannot reproduce", even though many people keep adding to it.

    I can reproduce this behaviour 100% of the times with my Galaxy S7 and also Galaxy S8.

    Any pointers of what I could do? I haven't felt the helpless in quite a while.

    Best wishes,
    Kjell
     
  2. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    4,855
    Sorry, closed what thread? Please attach the full logs (as an attachment, not inline text, thanks). I just tested with the sample project here with multiple finger touch without issue. But it doesn't process touch events either https://forum.unity.com/threads/sample-iap-project.529555/
     
    Last edited: Feb 6, 2019
  3. ph4ntomz

    ph4ntomz

    Joined:
    Jul 22, 2016
    Posts:
    19
    Sorry, I didn't expres myself clearly there. I meant that there's a bug report, but it was closed due to not being reproducible. Here's the report I was talking about: https://issuetracker.unity3d.com/issues/android-crash-fatal-signal-11-sigsegv-on-some-devices

    I've also attached the full log. I also doubt that the IAP package alone is responsible for this error to occur. Must clash with my custom code somehow, but since the error message is so general, I have no idea what/where to change. I'm also running on a tight schedule, so I try not to change the complete mobile input system in my game.

    Game Start is at: "02-11 14:05:20.089:"

    Best wishes,
    Kjell
     

    Attached Files:

    • log.txt
      File size:
      414.3 KB
      Views:
      968
    Last edited: Feb 11, 2019
  4. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    4,855
    I can confirm that this does not look to be an IAP issue. There are no Unity IAP entries in the log which tells me that this app is not using IAP. At least it was not ever initialized.
     
  5. ph4ntomz

    ph4ntomz

    Joined:
    Jul 22, 2016
    Posts:
    19
    It is weird though. When I go back in my commits, the first commit that works is the one right before importing and setting up the IAP package. When I go back to that commit it also works perfectly fine, but once I import the IAP the bug starts to occur again. So, it must be linked to the IAP in some way.

    Any idea what I could try as a workaround for this? Are there different versions of the IAP or maybe upgrade or downgrade Unity? Would that make sense?

    Best wishes,
    Kjell
     
  6. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    4,855
    Remove IAP for the time being since you are not using it.
     
  7. ph4ntomz

    ph4ntomz

    Joined:
    Jul 22, 2016
    Posts:
    19
    The game is going to be shipped in April and I have everything set up for the IAP in the game. Just removing it is not a workaround, if I have to get it back in a couple weeks later.
     
  8. ph4ntomz

    ph4ntomz

    Joined:
    Jul 22, 2016
    Posts:
    19
    I've now discovered that the Unity Analytics service seems to be the problem. When just turning on Unity Analytics WITHOUT IAP, the game starts to crash.
     
  9. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    4,855
    You mentioned "everything is setup for IAP in the game", how is that possible? To import IAP, you first need to enable Analytics. So you are not sharing the entire story. Does this occur with a brand new project? Please provide the logs to determine what is happening.
     
  10. ph4ntomz

    ph4ntomz

    Joined:
    Jul 22, 2016
    Posts:
    19
    I fixed the problem by upgrading to Unity 2017.4.20f2