Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Android 8.0 crashes application

Discussion in 'Android' started by dienat, May 16, 2018.

  1. dienat

    dienat

    Joined:
    May 27, 2016
    Posts:
    417
    I had an application for Gear VR that worked fine with a S8 with Android 7.0, i am trying to use it in another S8 with 8.0 but the applications crashes when i try to load a new scene with loadsceneasync using Unity 2018.1
    If i use Unity 5.3.5 the application fails when the progress ended, but the new scene doesnt appear and the application crash. Using 2018 i try target api 8.0 (api 26), with 5.3.5 i set the androidmanifest.xml with target api 26, the same as with 2018. It is about the memory cause if i use a scene with a few textures using 5.3.5 it works, but if i use 2018 it doesnt work even if i set a few textures, it crashes very little later loadsceneasyc starts
     
    Werfire likes this.
  2. dienat

    dienat

    Joined:
    May 27, 2016
    Posts:
    417
    In the Android log i get this error, after that i crashes
    05-18 06:28:07.723 26838 26883 E Unity : allocation 0x0xc0000007 already registered @ ./Runtime/GfxDevice/opengles/DataBuffersGLES.cpp:l238 size 96; now calling from ./Runtime/GfxDevice/opengles/DataBuffersGLES.cpp:l238 size 96?
    05-18 06:28:07.723 26838 26883 W Adreno-GSL: <gsl_ldd_control:541>: ioctl fd 84 code 0xc0140933 (IOCTL_KGSL_TIMESTAMP_EVENT) failed: errno 22 Invalid argument
    05-18 06:28:07.723 26838 26883 W Adreno-GSL: <ioctl_kgsl_syncobj_create:3977>: (55, 11, 15208) fail 22 Invalid argument
     
    Werfire likes this.
  3. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,167
  4. dienat

    dienat

    Joined:
    May 27, 2016
    Posts:
    417
    I debugged with Untiy 2018 and gives another error, it crashes just after i connect to server, when it reaches OnStartClient unet method it crashes, but it doesnt with 5.3
    I get the error :
    05-21 13:51:33.561 25769 26448 F libc : Fatal signal 7 (SIGBUS), code 1, fault addr 0xc28806fe in tid 26448 (UNET)
    05-21 13:51:33.588 25769 26290 I TimeWarp: Tear: 0.009735
    05-21 13:51:33.621 1554 5406 I WifiTrafficPoller: mCpuCoreBooster Lock
    05-21 13:51:33.658 26450 26450 E propClient: PropClient failed to load
    05-21 13:51:33.713 26451 26451 I crash_dump32: obtaining output fd from tombstoned
    05-21 13:51:33.718 1104 1104 I /system/bin/tombstoned: received crash request for pid 25769
    05-21 13:51:33.720 26451 26451 I crash_dump32: performing dump of process 25769 (target tid = 26448)
    05-21 13:51:33.721 26451 26451 F DEBUG : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
    05-21 13:51:33.721 26451 26451 F DEBUG : Build fingerprint: 'samsung/dreamqlteue/dreamqlteue:8.0.0/R16NW/G950U1UEU3CRD4:user/release-keys'
    05-21 13:51:33.721 26451 26451 F DEBUG : Revision: '12'
    05-21 13:51:33.721 26451 26451 F DEBUG : ABI: 'arm'
    05-21 13:51:33.721 26451 26451 F DEBUG : pid: 25769, tid: 26448, name: UNET >>> <<<
    05-21 13:51:33.721 26451 26451 F DEBUG : signal 7 (SIGBUS), code 1 (BUS_ADRALN), fault addr 0xc28806fe
    05-21 13:51:33.721 26451 26451 F DEBUG : r0 c2880662 r1 c28806fe r2 00000652 r3 00000652
    05-21 13:51:33.721 26451 26451 F DEBUG : r4 0000002a r5 000005aa r6 b6cd4d34 r7 c2880010
    05-21 13:51:33.721 26451 26451 F DEBUG : r8 c4d03150 r9 b6cd4c40 sl b6d19590 fp b677f878
    05-21 13:51:33.721 26451 26451 F DEBUG : ip c2880010 sp b677f830 lr cc895688 pc cc8956b8 cpsr 60010010
    05-21 13:51:33.746 26451 26451 F DEBUG :
    05-21 13:51:33.746 26451 26451 F DEBUG : backtrace:
    05-21 13:51:33.746 26451 26451 F DEBUG : #00 pc 00d126b8 /data/app/-KVtf1gxrFVApSFQYY_SyAg==/lib/arm/libunity.so (_ZN4UNET27InterThreadCommunicationBusINS_16UnetMemoryBufferENS_12MessageQueueES2_NS_31MemoryBufferAllocatingBehaviourEE26ProducerForceSilentAcquireEi+148)
    05-21 13:51:33.746 26451 26451 F DEBUG : #01 pc 00d04ee8 /data/app/-KVtf1gxrFVApSFQYY_SyAg==/lib/arm/libunity.so (_ZN4UNET17PacketDistributor9OnReceiveEPNS_4HostE+196)
    05-21 13:51:33.746 26451 26451 F DEBUG : #02 pc 00d049c4 /data/app/-KVtf1gxrFVApSFQYY_SyAg==/lib/arm/libunity.so (_ZN4UNET7Reactor14DispatchSelectEv+540)
    05-21 13:51:33.746 26451 26451 F DEBUG : #03 pc 00cfec04 /data/app/KVtf1gxrFVApSFQYY_SyAg==/lib/arm/libunity.so (_ZN4UNET7Reactor3RunEv+40)
    05-21 13:51:33.746 26451 26451 F DEBUG : #04 pc 00d0468c /data/app/-KVtf1gxrFVApSFQYY_SyAg==/lib/arm/libunity.so (_ZN4UNET7Reactor10ThreadFuncEPv+16)
    05-21 13:51:33.746 26451 26451 F DEBUG : #05 pc 00769c30 /data/app/-KVtf1gxrFVApSFQYY_SyAg==/lib/arm/libunity.so (_ZN6Thread16RunThreadWrapperEPv+84)
    05-21 13:51:33.746 26451 26451 F DEBUG : #06 pc 00048e9f /system/lib/libc.so (_ZL15__pthread_startPv+22)
    05-21 13:51:33.746 26451 26451 F DEBUG : #07 pc 0001b871 /system/lib/libc.so (__start_thread+32)
     
    Last edited: May 21, 2018
  5. Yury-Habets

    Yury-Habets

    Unity Technologies

    Joined:
    Nov 18, 2013
    Posts:
    1,167
  6. Werfire

    Werfire

    Joined:
    Feb 23, 2018
    Posts:
    2
    Something like this happens on my Android 8.0 too when I'm trying to use my coroutine for 8th time to analyze color of texture to count score like in Splatoon. I think the problem in InkPainter asset function Es.InkPainter.InkCanvas.GetPaintMainTexture().
    The error says:
    "AndroidPlayer(HTC_HTC_10@10.63.0.99)</i> allocation 0x0xc00003e8 already registered @ /Users/builduser/buildslave/unity/build/Runtime/GfxDevice/opengles/DataBuffersGLES.cpp:l234 size 4096; now calling from /Users/builduser/buildslave/unity/build/Runtime/GfxDevice/opengles/DataBuffersGLES.cpp:l234 size 4096?" And there are like 300 similar to this error messages, then android device rebooted.

    Same happens on my Android 6.0 tablet exactly in the same 8th run of coroutine.

    In coroutine to optimize CPU usage of the phone I divided whole 4096x4096 map texture into 256 square pieces, than converted them to Texture2D from RenderTexture (mainTex) and analyzed color of pixels, skipping frames to avoid freezing the game.

    Code of coroutine I call every 10 seconds:

    Code (CSharp):
    1. public static bool analyzing = false;
    2.     public IEnumerator AnalyzeMainTexture()
    3.     {
    4.         analyzing = true;
    5.         mainTex = canvas.GetPaintMainTexture("Sample");
    6.         float analyzeStart = Time.time;
    7.  
    8.         Texture2D[] tempTexes = new Texture2D[256];
    9.         int width = mainTex.width;
    10.         int height = mainTex.height;
    11.         int blockWidth = width / (int)Mathf.Sqrt(tempTexes.Length);
    12.         int blockHeight = height / (int)Mathf.Sqrt(tempTexes.Length);
    13.  
    14.         int greenPixels = 0;
    15.         int redPixels = 0;
    16.      
    17.         for(int i = 0; i < tempTexes.Length; i++)
    18.         {
    19.             RenderTexture.active = mainTex;
    20.             tempTexes[i] = new Texture2D(blockWidth, blockHeight);
    21.             tempTexes[i].ReadPixels(new Rect(i / (int)Mathf.Sqrt(tempTexes.Length) * blockWidth,
    22.                 (i % (int)Mathf.Sqrt(tempTexes.Length)) * blockHeight, blockWidth, blockHeight), 0, 0, false);
    23.  
    24.             for(int j = 0; j < blockWidth; j += 16)
    25.             {
    26.                 for(int k = 0; k < blockHeight; k += 16)
    27.                 {
    28.                     Color pixelColor = tempTexes[i].GetPixel(j, k);
    29.  
    30.                     if(pixelColor == Color.green)
    31.                         greenPixels++;
    32.                     else if(pixelColor == Color.red)
    33.                         redPixels++;
    34.                 }
    35.             }
    36.             RenderTexture.active = null;
    37.             //if(i % 4 == 3)
    38.                 yield return new WaitForEndOfFrame();
    39.         }
    40.  
    41.         if(greenPixels + redPixels > 0)
    42.         {
    43.             greenTeamScore = 100 * greenPixels / (greenPixels + redPixels);
    44.             redTeamScore = 100 - greenTeamScore;
    45.         }
    46.      
    47.         if(matchEnded)
    48.             RpcEndMatch();
    49.  
    50.         //Debug.Log("Green: " + greenPixels);
    51.         //Debug.Log("Red: " + redPixels);
    52.         Debug.Log("AnalyzeTime: " + (Time.time - analyzeStart));
    53.         analyzing = false;
    54.     }
    How to avoid this error messages? Is it possible on mobile device, which is of course doesn't have graphics card like PC? Most of the time game just exits without any messages, but I finally managed to track this sequence of errors via ADB.

    Sorry if my English is bad, I hope you understood what I wanted to say.
     
    Last edited: Oct 1, 2018
  7. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    2,983
    @Maksimonchik try allocating just one texture, reading to it once at the beginning of the coroutine, and then doing your analysis in blocks.
    Reading back pixels is a very costly operation, and I don't think it matters much if you do it in blocks or read the whole texture back.
     
    Werfire likes this.
  8. Werfire

    Werfire

    Joined:
    Feb 23, 2018
    Posts:
    2
    @aleksandrk But the reason why I divided texture to blocks is that Texture2D.ReadPixels from 4096x4096 texture makes game to freeze for nearly 0.3 secs even on PC. So I tried to divide ReadPixels by frames, but it seems like created a new problem with memory. For now I decided to just call this coroutine for once in the end of match, so the players won't know current score and process of calculating result will be more intriguing. Thanks for reply though, I didn't even thought what problem can be in common ReadPixels and not in asset function.
     
    Last edited: Oct 2, 2018
  9. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    2,983
    ReadPixels make the CPU wait till the GPU finishes rendering everything till that point, which is super slow. Normally, the CPU doesn't have to wait for the GPU to finish in the middle of the frame. This is very likely the source of your problem.
    To check, try lowering the resolution of your texture to e.g. 256x256 and measure the performance.