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

Resource ID out of range in GetResource error on Linux

Discussion in 'Image Effects' started by KMacro, Jun 20, 2019.

  1. KMacro

    KMacro

    Joined:
    Jan 7, 2019
    Posts:
    48
    My game is crashing after sitting for a number of hours. At the end of my log file I see the following error 7-8 times followed by a crash:

    Resource ID out of range in GetResource: 1048576 (max is 1048575)
    (Filename: ./Runtime/GfxDevice/GfxResourceIDMap.h Line: 109)


    Searching for this error leads to the following (now closed) issue on Github:

    https://github.com/Unity-Technologies/PostProcessing/issues/643

    I am using the post processing stack in my project (v 2.1.7), but I am not using any SSR.

    I have remotely profiled my game with both the Profiler and the experimental Memory Profiler and do not see any allocated memory growing over the course of 2-3 hours (These crashes usually happen when the game is left running overnight).

    I have tried to recreate this issue in a simpler project to my game so that I can submit a bug report but cannot reproduce the issue.

    I am using Lubuntu 18.04. I do not see the same issue occurring when running my game on Windows.
     
  2. KMacro

    KMacro

    Joined:
    Jan 7, 2019
    Posts:
    48
    I had initially thought the crash dump was generic, but upon further inspection that is not the case.

    Receiving unhandled NULL exception
    #0 0x00000001c4a828 in gles::BlitFramebuffer(gles::BlitFrameBufferDrawQuad8&, GfxDevice&, int, int, TextureID, int, int, int, int, int, int, int, int)
    #1 0x00000001c78e0c in GfxFrameBufferGLES::GrabIntoRenderTexture(RenderSurfaceGLES*, int, int, int, int)
    #2 0x000000009b5520 in GfxDeviceWorker::RunCommand(ThreadedStreamBuffer&)
    #3 0x000000009ab4aa in GfxDeviceWorker::RunExt(ThreadedStreamBuffer&)
    #4 0x000000009ab5f1 in GfxDeviceWorker::Run()
    #5 0x000000009ab609 in GfxDeviceWorker::RunGfxDeviceWorker(void*)
    #6 0x000000013421fa in Thread::RunThreadWrapper(void*)
    #7 0x007fc77afe96db in start_thread
    #8 0x007fc77ad1288f in clone


    I ran my game on my Linux box first thing this morning and was able to observe an actual crash while profiling. Nothing looked out of the ordinary.
     
  3. KMacro

    KMacro

    Joined:
    Jan 7, 2019
    Posts:
    48
    Also, here is a screenshot of my Post Process Volume.
     

    Attached Files:

  4. josterday

    josterday

    Joined:
    Jan 22, 2018
    Posts:
    51
    Bump on this.

    Seeing the same error on Windows 10 with 2018.3.14 and PPSv2

    After about 2-3 hours running. When exporting to offline renders, it'll happen after 700-1000 frames.
     
    KMacro likes this.
  5. KMacro

    KMacro

    Joined:
    Jan 7, 2019
    Posts:
    48
    Small update: I still haven't found the cause of this problem, but I did have it occur in the editor on Windows. I left the editor running in play mode but paused overnight and I came back to find the same errors filling my console. Unity was unresponsive, and I needed to end the Editor process from the Task Manager and restart Unity.
     
  6. sichch

    sichch

    Joined:
    Aug 1, 2016
    Posts:
    2
    I just meet the same error. for me it is coused by RenderTexture not release successful.
    in function LateUpdate ,i create RenderTexture use code
    Code (CSharp):
    1.                     tempRenderTexture = RenderTexture.GetTemporary(
    2.                        texture.width,
    3.                        texture.height,
    4.                        0,
    5.                        RenderTextureFormat.Default,
    6.                        RenderTextureReadWrite.Linear);
    7.                        Graphics.Blit(texture, tempRenderTexture);
    8.                        tempTexture2d.ReadPixels(new Rect(0, 0, tempRenderTexture.width, tempRenderTexture.height), 0, 0);
    after use it,i try to release use code
    Code (CSharp):
    1.   tempRenderTexture.Release();
    then it cause the error "Resource ID out of range in GetResource" after about 3 hours running
    I fixed it use code
    Code (CSharp):
    1.  RenderTexture.ReleaseTemporary(tempRenderTexture);
    hope be helpful
     
    twobob, pelaezjorge and a436t4ataf like this.
  7. jbrooksh

    jbrooksh

    Joined:
    Jun 25, 2019
    Posts:
    1
    Same issue.
     
  8. a436t4ataf

    a436t4ataf

    Joined:
    May 19, 2013
    Posts:
    1,924
    As per @sichch's solution - the docs are very unclear on this, but it turns out that "Release()" is broken for temporary RT's, and you must NOT use it. Instead, you need to use the static "ReleaseTemporary( x )" method.

    This kind-of makes sense - Unity is doing some resource-sharing behind the scenes managed at the static/class level - but it violates some basic expectations of texture operations I had from years of working with low-level textures ("always remember to call release()" and "release() works or throws errors if it fails [it doesnt throw errors, sadly :( ]"), so I'm suspicious this counts as a bug.
     
  9. JescoInazuma

    JescoInazuma

    Joined:
    Dec 12, 2020
    Posts:
    10
    Are there any Updates on this, i am using this Blit RenderPass to achieve a PostProcessing Effect and i am experiencing the same Issue.
    As you can see in the Code it is using
    cmd.ReleaseTemporaryRT(m_DestinationTexture.id);
    on the CommandBuffer to release the RenderTexture. I can't use the recommended Method to release the Texture, since it is saved as a RenderTargetIdentifier and not as a RenderTexture.

    Is there anything i can do to fix this?
     
  10. a436t4ataf

    a436t4ataf

    Joined:
    May 19, 2013
    Posts:
    1,924
    Report a bug - I never got a reply. I'm pretty sure it's a bug, but I didn't report it because Unity usually ignores such reports (they tell you "use the workaround" because they generally don't want to fix bugs like this if they can avoid it) ... but if you've got a specific case where the workaround won't work you're likely to get their attention and I'm sure they'll want to fix.
     
    JescoInazuma likes this.
  11. JescoInazuma

    JescoInazuma

    Joined:
    Dec 12, 2020
    Posts:
    10
    Ok thank you, i will try that
     
  12. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    Resource ID out of range in GetResource: 1745614 (max is 1048575)
     
  13. a436t4ataf

    a436t4ataf

    Joined:
    May 19, 2013
    Posts:
    1,924
    1234567890.
     
  14. mohammadhomsee

    mohammadhomsee

    Joined:
    Feb 25, 2022
    Posts:
    1
    i think the problem is using released render texture,
    in my project I was rendering on texture every frame, every thing was fine, frame rate was over 150, after like 1 hour this error occurred, I was able to reproduce the bug by modify released texture.

    my expectation for this problem that unity is releasing texture after some period of time, or at least doing some thing similar to that.

    Still working on that to find some solution.
    I will be appreciated if somebody could help.