Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

What does Mprotect remapping failed mean and how do I fix it?

Discussion in 'iOS and tvOS' started by QuantumCalzone, Dec 10, 2015.

  1. QuantumCalzone

    QuantumCalzone

    Joined:
    Jan 9, 2010
    Posts:
    262
    Hey guys!

    I'm stumped with an error I found and from my searches, only a few have also received it a long time ago and I'm not quite sure if / how a solution was achieved.

    The error I'm getting in xcode is
    Code (csharp):
    1. Mprotect failed at 0xed50000 (length 212992) with errno 12
    2. Mprotect remapping failed
    The game works fine in the editor and all other platforms. This error is iOS specific and happens every session that goes past the login process (loads another scene) for > 10 seconds. The exact time is inconsistent.
    I say inconsistently because it doesn't seem to happen right after an interaction. My game does download data and images so my hunch (and a lousy hunch at that) is threading / wait time is the cause of the inconsistently.

    Here's some of my search results
    My system info
    Currently on Unity 5.3 but has been happening since 5.2
    Xcode is version 7.2 but has been happening since 7.0 I think
    My game is 2d, it uses NGUI, it downloads data and images from the internet.

    Thank you so much for your read and time. Hope you can help!
     
  2. QuantumCalzone

    QuantumCalzone

    Joined:
    Jan 9, 2010
    Posts:
    262
    looks like it also is giving out the error code
    Code (CSharp):
    1. Using Unity SDK v7.2.2
    2. (Filename: /Users/builduser/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 37)
    3.  
    4. Using Unity SDK v7.2.2 with FBiOSSDK/4.7.0
    5. (Filename: /Users/builduser/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 37)
    6.  
    7. Mprotect failed at 0x416f8000 (length 4751360) with errno 12
    8. Mprotect remapping failed
    9. (lldb)
    the xcode window above is displaying

    Code (CSharp):
    1. GIFingAround`::Texture2D_CUSTOM_GetPixels():
    2.     0x21e9bf8 <+0>:   push   {r4, r5, r6, r7, lr}
    3.     0x21e9bfc <+4>:   add    r7, sp, #12
    4.     0x21e9c00 <+8>:   push   {r8, r10, r11}
    5.     0x21e9c04 <+12>:  sub    sp, sp, #20
    6.     0x21e9c08 <+16>:  mov    r5, r0
    7.     0x21e9c0c <+20>:  cmp    r5, #0
    8.     0x21e9c10 <+24>:  ldrne  r0, [r5, #0xc]
    9.     0x21e9c14 <+28>:  mov    r11, r3
    10.     0x21e9c18 <+32>:  cmpne  r0, #0
    11.     0x21e9c1c <+36>:  beq    0x21e9cd0                 ; <+216> [inlined] GetReference at ScriptingObjectOfType.h:105
    12.     0x21e9c20 <+40>:  ldr    r8, [r7, #0x8]
    13.     0x21e9c24 <+44>:  mov    r10, r1
    14.     0x21e9c28 <+48>:  ldrb   r1, [r0, #0x6b]
    15.     0x21e9c2c <+52>:  str    r2, [sp, #0x10]
    16.     0x21e9c30 <+56>:  cmp    r1, #0
    17.     0x21e9c34 <+60>:  bne    0x21e9c58                 ; <+96> at TextureBindings.gen.cpp:413
    18.     0x21e9c38 <+64>:  ldr    r1, [r0]
    19.     0x21e9c3c <+68>:  ldr    r1, [r1, #0x20]
    20.     0x21e9c40 <+72>:  blx    r1
    21.     0x21e9c44 <+76>:  mov    r1, r0
    22.     0x21e9c48 <+80>:  movw   r0, #0x1772
    23.     0x21e9c4c <+84>:  movt   r0, #0x6c
    24.     0x21e9c50 <+88>:  add    r0, pc, r0
    25.     0x21e9c54 <+92>:  bl     0x1d98734                 ; ::RaiseMonoException() at Scripting_Mono.cpp:87
    26.     0x21e9c58 <+96>:  mul    r4, r8, r11
    27.     0x21e9c5c <+100>: bl     0x1eced88                 ; ::GetCoreScriptingClasses() at CoreScriptingClasses.cpp:274
    28.     0x21e9c60 <+104>: ldr    r0, [r0, #0x94]
    29.     0x21e9c64 <+108>: mov    r1, #16
    30.     0x21e9c68 <+112>: mov    r2, r4
    31.     0x21e9c6c <+116>: bl     0x1d99654                 ; ::scripting_array_new() at ScriptingBackendApi_Mono.cpp:543
    32.     0x21e9c70 <+120>: mov    r6, r0
    33.     0x21e9c74 <+124>: mov    r1, #0
    34.     0x21e9c78 <+128>: mov    r2, #16
    35.     0x21e9c7c <+132>: bl     0x1d99644                 ; ::scripting_array_element_ptr() at ScriptingBackendApi_Mono.cpp:533
    36.     0x21e9c80 <+136>: mov    r4, r0
    37.     0x21e9c84 <+140>: ldr    r0, [r5, #0xc]
    38.     0x21e9c88 <+144>: cmp    r0, #0
    39.     0x21e9c8c <+148>: bne    0x21e9c9c                 ; <+164> at ScriptingObjectOfType.h:32
    40.     0x21e9c90 <+152>: mov    r0, r5
    41.     0x21e9c94 <+156>: bl     0x1d988e8                 ; ::RaiseNullExceptionObject() at Scripting_Mono.cpp:202
    42.     0x21e9c98 <+160>: mov    r0, #0
    43.     0x21e9c9c <+164>: ldr    r1, [r7, #0xc]
    44.     0x21e9ca0 <+168>: mov    r3, r11
    45.     0x21e9ca4 <+172>: str    r8, [sp]
    46.     0x21e9ca8 <+176>: stmib  sp, {r1, r4}
    47.     0x21e9cac <+180>: mov    r1, #0
    48.     0x21e9cb0 <+184>: ldr    r2, [sp, #0x10]
    49.     0x21e9cb4 <+188>: str    r1, [sp, #0xc]
    50.     0x21e9cb8 <+192>: mov    r1, r10
    51.     0x21e9cbc <+196>: bl     0x1dd0d34                 ; ::GetPixels() at Texture2D.cpp:1215
    52.     0x21e9cc0 <+200>: mov    r0, r6
    53.     0x21e9cc4 <+204>: sub    sp, r7, #24
    54.     0x21e9cc8 <+208>: pop    {r8, r10, r11}
    55.     0x21e9ccc <+212>: pop    {r4, r5, r6, r7, pc}
    56.     0x21e9cd0 <+216>: mov    r0, r5
    57.     0x21e9cd4 <+220>: bl     0x1d988e8                 ; ::RaiseNullExceptionObject() at Scripting_Mono.cpp:202
    58.  
    I'm wondering if its an NGUI issue?

    Someone else did have the issue as well so its not just me.
     
  3. PDZ

    PDZ

    Joined:
    Sep 12, 2013
    Posts:
    18
    I am also having the same issue, with uploading 'large' files (tested on 10 - 20 MB files). Something wrong with the WWW class? I have tested on Unity 5.1 and 5.3

    Screen Shot 2016-01-19 at 11.13.54.png
     
  4. PDZ

    PDZ

    Joined:
    Sep 12, 2013
    Posts:
    18
    Have you found a solution/reported the bug via the editor?
     
  5. QuantumCalzone

    QuantumCalzone

    Joined:
    Jan 9, 2010
    Posts:
    262
    Haven't found a solution yet and have't gotten the bug to happen in the editor either. It only happens on ios builds.
     
  6. orb

    orb

    Joined:
    Nov 24, 2010
    Posts:
    3,033
    I think he meant report it via the bug reporter menu item in the editor. Is your project small enough that you feel like giving it to them, or can you reproduce the error with a smaller one?

    Your hunch is possibly right, as mprotect() has to do with memory region protection. It could be a case of memory being write-protected when it shouldn't due to a race condition. It doesn't seem like something that is directly your fault either.
     
  7. QuantumCalzone

    QuantumCalzone

    Joined:
    Jan 9, 2010
    Posts:
    262
    Oh ok I see. My project isn't small enough right now but I can work on reducing it to just the bare essentials and report it.

    Well that's kind of a relief :)

    I should also point out that when inspecting available memory in xcode on my device, my app is using like 25% of available memory leaving like 45% free (when you take into account background memory).
     
  8. QuantumCalzone

    QuantumCalzone

    Joined:
    Jan 9, 2010
    Posts:
    262
    took me a while but I submitted the bug with my project. I'll update once I get the link.
     
    PDZ likes this.
  9. QuantumCalzone

    QuantumCalzone

    Joined:
    Jan 9, 2010
    Posts:
    262
    how long does it usually take to get your bug into the public issue tracker?
     
  10. orb

    orb

    Joined:
    Nov 24, 2010
    Posts:
    3,033
    Weekends are pretty random. It's happened, but it really depends on somebody receiving it and being really eager to fix it :)
     
  11. QuantumCalzone

    QuantumCalzone

    Joined:
    Jan 9, 2010
    Posts:
    262
    Lol didn't expect it on the weekends. That makes sense though.

    @PDZ, could you also submit a bug? Maybe we can find strength in numbers.
     
    PDZ likes this.
  12. Mantas-Puida

    Mantas-Puida

    Unity Technologies

    Joined:
    Nov 13, 2008
    Posts:
    1,864
    Did you receive your case number?
     
  13. QuantumCalzone

    QuantumCalzone

    Joined:
    Jan 9, 2010
    Posts:
    262
    Yes it is 763225
     
  14. QuantumCalzone

    QuantumCalzone

    Joined:
    Jan 9, 2010
    Posts:
    262
    just got an email!

    :D
     
    PDZ likes this.
  15. orb

    orb

    Joined:
    Nov 24, 2010
    Posts:
    3,033
    Awesome - confirmation is the best, even if it's not fixed immediately :)
     
  16. PDZ

    PDZ

    Joined:
    Sep 12, 2013
    Posts:
    18
    Can you please share a link to the bug report so we can view it/monitor updates?
     
  17. QuantumCalzone

    QuantumCalzone

    Joined:
    Jan 9, 2010
    Posts:
    262