Search Unity

JobTempAlloc has allocations that are more than 4 frames old

Discussion in 'iOS and tvOS' started by dcecar, Jun 11, 2019.

  1. dcecar

    dcecar

    Joined:
    Dec 7, 2016
    Posts:
    7
    I get these errors on the console in xcode:


    Internal: JobTempAlloc has allocations that are more than 4 frames old - this is not allowed and likely a leak
    (Filename: ./Runtime/Allocator/ThreadsafeLinearAllocator.cpp Line: 539)
    To Debug, enable the define: TLA_DEBUG_STACK_LEAK in ThreadsafeLinearAllocator.cpp. This will output the callstacks of the leaked allocations
    (Filename: ./Runtime/Allocator/ThreadsafeLinearAllocator.cpp Line: 541)
    also...

    Internal: deleting an allocation that is older than its permitted lifetime of 4 frames (age = 12)
    (Filename: ./Runtime/Allocator/ThreadsafeLinearAllocator.cpp Line: 313)

    I don't use Jobs or async operations except for LoadSceneAsync and UnloadSceneAsync.

    The errors are intermittent, there will be a period when it spams the console, then a period of nothing.. then a few here and there.. then spam again etc. I have been trying to eliminate objects that might be causing it, but it seems like multiple things can cause it. I've had it go away when I disable the 1 directional light with shadow, some particle effects, or line renderers, but it's not constantly a single type of object.

    Only happening on IOS. I am testing on Iphone 6+. Windows/Editor and Mac/Editor do not have the issue.

    Unity version 2019.1.5f1 (6f1140cf2297)

    It would be really useful for Unity to allow us to enable some debug flag that would let us track where these allocations come from, because as it is now its internal and we have no way of debugging this that i know.
     
    elaissaouihamza likes this.
  2. kahyong_unity

    kahyong_unity

    Unity Technologies

    Joined:
    Jan 17, 2019
    Posts:
    5
    Are you able to send us a link to your repro project for this?
     
  3. dcecar

    dcecar

    Joined:
    Dec 7, 2016
    Posts:
    7
    I will get this to you later today. thanks
     
  4. 8bitgoose

    8bitgoose

    Joined:
    Dec 28, 2014
    Posts:
    448
    Any update on this? I am having the same issue.
     
    jumasudo likes this.
  5. dyox

    dyox

    Joined:
    Aug 19, 2011
    Posts:
    619
    Same issue on 2019.3.0a11
     
  6. greg-harding

    greg-harding

    Joined:
    Apr 11, 2013
    Posts:
    524
    We're also getting hundreds of these messages spamming the console using 2019.1.x (currently 2019.1.14f1) on some devices (eg. iPhone 5s, iOS 12.3.x) but not so many on others (eg. iPhone 8, X).
     
    Last edited: Aug 22, 2019
  7. Jbs_GameZone

    Jbs_GameZone

    Joined:
    Dec 14, 2018
    Posts:
    118
    Same issue here, using Unity 2019.2.1f1 with Xcode 11 (beta 5). Testing on low end devices Iphone6 IOS 11 & 6 Plus IOS 12.4.
    It is a pain in the neck to debug, blindly commenting out different parts of the scripts and testing. A stacktrace would be great to locate them precisely.

    Update:
    -One reason was casting or receiving shadows on meshes (or particles). After disabling them it was ok.

    -But, there are other cases, now I notice that it occurs if I have a second (or third) active camera in scene that renders on render texture (car mirrors). If I disable the mirrors the game plays for hours without a glitch. If I enable them it throws this err in the first minutes.
     
    Last edited: Aug 22, 2019
    pojoih, oAzuehT, Egad_McDad and 2 others like this.
  8. Feelnside

    Feelnside

    Joined:
    Sep 30, 2016
    Posts:
    83
    I'm having the same issue (Unity 2019.1, the all versions I have used, currently it's on Unity 2019.1.14f; iPhone 5s, iOS 12.4).
     
    Nolex likes this.
  9. clinton_d

    clinton_d

    Joined:
    Feb 11, 2011
    Posts:
    17
    THANKYOU THANKYOU THANKYOU!!

    Shadow casting was causing the issue for me.

    Specifically, my newer test devices were not throwing any erroneous logs when running on XCode. So everything was looking good for release. My final check involves testing on older (and still dominant) devices. At which point the logs started being clogged with this issue.

    Disabling shadows for the older devices solved the issue.

    In future, I'll continue to do my primary dev on the older devices ...
     
    Egad_McDad, Nolex and Jbs_GameZone like this.
  10. AurimasA

    AurimasA

    Unity Technologies

    Joined:
    Apr 24, 2017
    Posts:
    24
    Hello everyone, could someone submit a bug report regarding "Internal: JobTempAlloc has allocations that are more than 4 frames old - this is not allowed and likely a leak" errors on iOS and post the bug ID here?
     
  11. greg-harding

    greg-harding

    Joined:
    Apr 11, 2013
    Posts:
    524
  12. BuzzJive

    BuzzJive

    Joined:
    Mar 6, 2014
    Posts:
    75
    Seeing this on tvOS as well - definitely with the Apple TV HD. I hope the repro above can be used to fix it there as well.
     
  13. 8bitgoose

    8bitgoose

    Joined:
    Dec 28, 2014
    Posts:
    448
    So if a null error is thrown preventing a TempJob from being disposed in a round you will get this error. It will also keep stacking and not go away until you reboot the unity editor because the editor is tracking the thing you didn't dispose.

    If you get it a lot after restarting then I done know what can be done.
     
  14. BuzzJive

    BuzzJive

    Joined:
    Mar 6, 2014
    Posts:
    75
    As followup - we are absolutely not running any Jobs code ourselves, but clearly there's some internal stuff running it. This message also went away when I disabled the shadows completely.
     
  15. 8bitgoose

    8bitgoose

    Joined:
    Dec 28, 2014
    Posts:
    448
    @BuzzJive Totally, do you get it even if you've had no errors in the editor? Cause the internal stuff will get interrupted by an error and would get that job error. Just want a better stack trace for this...
     
  16. BuzzJive

    BuzzJive

    Joined:
    Mar 6, 2014
    Posts:
    75
    @8bitgoose I think I understand what you are asking. There are no errors in our game at the time. Other platforms are running everything as expected. tvOS is running as expected as well, but it throws this Job Tempalloc error from seemingly nowhere - sometimes just occasionally, sometimes flooding the logs.
     
  17. 8bitgoose

    8bitgoose

    Joined:
    Dec 28, 2014
    Posts:
    448
    @BuzzJive Ah thanks for the confirmation. It took me weeks to figure out why it was happening and many posts before I realize what I was doing wrong. Pretty rough if you aren't even touching the jobs systems :(.
     
  18. greg-harding

    greg-harding

    Joined:
    Apr 11, 2013
    Posts:
    524
    Unity QA could not replicate the problem in my bug report (1182525). If anyone has a repro case handy please bug report it and reference case 1182525. I'll try to make a repro for it when I get a moment.
     
  19. brianchasalow

    brianchasalow

    Joined:
    Jun 3, 2010
    Posts:
    208
    Any news on this? I'm seeing this spam in my ARKit app as well, iOS 13, Xcode 11 GM 2. iPhone X. Unity 2019.2.6f1
     
  20. Numa

    Numa

    Joined:
    Oct 7, 2014
    Posts:
    100
    @greg-harding From what I've seen it starts happening when the device starts lagging / overheating. On older ipads I get this warning almost constantly, but on an iPhone XS I only get it after a while once the phone has overheated and everything starts to get out of sync. So if they try to reproduce it with a very simple project and a cube on a recent device, they will never encounter the problem. If you have time try to give them a scene with 1,000,000 triangles + a bunch of post processing effects, lots of game objects with busy Update() methods, and tell them to test it on an iPhone 6S :D
     
  21. greg-harding

    greg-harding

    Joined:
    Apr 11, 2013
    Posts:
    524
    Yeah, as soon as I run anything on an iPhone 5s or iPad Air (original) it throws these errors. I haven't had time to repro it yet but adding a sceneload of stuff should do the trick :)
     
  22. Forberg

    Forberg

    Joined:
    Oct 27, 2018
    Posts:
    25
    Getting this spam on the console randomly. Not using the Job System at all. Once the spam starts the framerate drops and the memory starts filling up.
     
  23. 8bitgoose

    8bitgoose

    Joined:
    Dec 28, 2014
    Posts:
    448
    I found that if my game ran with too high a frame rate these would pile up. Try limiting your frame rate to whatever the screen refresh is and see if that helps.
     
    xxvkvk likes this.
  24. Forberg

    Forberg

    Joined:
    Oct 27, 2018
    Posts:
    25
    Thanks will give it a try, I am indeed running with pretty high framerate

    Set Application. targetFrameRate = 120.
    Aaand I think that fixed it! Was having this issue for weeks and already had nightmares about it! Thank you so much!
     
  25. bourriquet

    bourriquet

    Joined:
    Jul 17, 2012
    Posts:
    181
    Any news on that? I need the shadow casting and the render texture camera. So I'm kind of screwed here. Also I can't find the bug in the issue tracker.
     
    Nolex and T-Zee like this.
  26. litebox

    litebox

    Joined:
    Aug 29, 2011
    Posts:
    158
    Also have this issue, Unity 2019.2, iPad Mini 2
     
  27. Barliesque

    Barliesque

    Joined:
    Jan 12, 2014
    Posts:
    128
    I'm seeing these warnings on a Windows standalone project. Adding
    Application.targetFrameRate = 120;
    did not resolve the issue.
     
  28. NovaEiz

    NovaEiz

    Joined:
    Sep 6, 2017
    Posts:
    53
    The same problem on Linux. The server build.
    There is no such spam on MacOS.
    2020.1.0b1
     
    adammpolak likes this.
  29. Nolex

    Nolex

    Joined:
    Dec 10, 2010
    Posts:
    116
    @litebox @bourriquet @Forberg @greg-harding @clinton_d @Jbs_GameZone @8bitgoose @dcecar
    Any news?

    I have same problem:
    With real-time shadows - FAIL (spam logs).
    Without - OK (no spam logs).

    I tried to build my game with different parameters, but this did not help:
    - Remove UNITY_POST_PROCESSING_STACK_V2 from Player Settings;
    - Change Application.targetFrameRate;
    - Multithreaded rendering ON/OFF;
    - Change Graphics API (Metal / OpenGL 3);
    - Change Quality Setting (Shadow, Anti-aliasing).

    Devices: iPhone 5S, iPad Mini 2.
    Unity 2019.2.12f.

    Same issues:
    https://issuetracker.unity3d.com/is...ne-build-output-log-if-trees-are-in-the-scene
    https://issuetracker.unity3d.com/issues/memory-leak-in-shadowmapjobheader

    Please help!
     
    Last edited: May 16, 2020
    Jimaniki likes this.
  30. Nolex

    Nolex

    Joined:
    Dec 10, 2010
    Posts:
    116
    I have done many experiments.
    The problem is reproduced even in an empty project.

    How to reproduce
    1) Create an empty project with 2 Cubes and 1 Directional Light.
    2) Set Quality Settings to Medium (shadows must be enable).
    3) Build and Run for iOS.
    4) See logs in xcode (wait 5-300 seconds).

    Devices reproducible with:
    iPhone 5S, iPad Mini 2.

    Unity 2019.2.12f (Windows 10)
    Xcode 11.4.1 (macOS 10.15.4 Catalina)

    I sent a new case (bug report): 1247869 (with reference case 1182525).

     

    Attached Files:

    Jimaniki likes this.
  31. funselektor

    funselektor

    Joined:
    Oct 11, 2013
    Posts:
    105
    One thing that helped in 2019.2 was to turn on Vsync,
    These errors started popping up again after I updated to 2019.3 and all the latest collections, jobs, burst packages.
     
  32. Nolex

    Nolex

    Joined:
    Dec 10, 2010
    Posts:
    116
    It does not help. I tested.
     

    Attached Files:

  33. hmtyzr

    hmtyzr

    Joined:
    Dec 22, 2016
    Posts:
    7
    I am having the same issues in 2019.3. Tried some tips but nothing helped yet. In my case, most spam messages appear during first run of the application. Nothing afterwards. I am using Addressables package and loading a few bundles at app start. It does not seem related to Addressables, though. I first noticed those messages thanks to GameAnalytics error reporting. Would appreciate any help. Thanks.
     

    Attached Files:

  34. greg-harding

    greg-harding

    Joined:
    Apr 11, 2013
    Posts:
    524
    No, sorry. We submitted bugs to Unity but they could not replicate the issue. It seemed related to shadows on/off and perhaps MSAA. It usually appeared on some older iOS devices, eg. 5s, older iPhones and iPads, and on newer devices when they heated up. We could never work around it so just lived with the messages.
     
  35. Hellride

    Hellride

    Joined:
    Jan 2, 2014
    Posts:
    10
    Had a similar issue in the past. May sound silly to mention, but make certain Pixel Light Count is set to 0 within Player Settings | Quality. I was developing on an iPhone 6 Plus at the time and had inadvertently set Pixel Light Count to 1.
     
  36. dyox

    dyox

    Joined:
    Aug 19, 2011
    Posts:
    619
  37. Nolex

    Nolex

    Joined:
    Dec 10, 2010
    Posts:
    116
    I tested it on an iPhone 5s.
    Pixel Light Count does not help.
     
  38. LvChy

    LvChy

    Joined:
    Mar 6, 2020
    Posts:
    4
    same issue on android devices . Use Unity 2018 4.21f1
     
  39. 8bitgoose

    8bitgoose

    Joined:
    Dec 28, 2014
    Posts:
    448
    They need to disable this spamming message. It is useless to fill a log file with a useless stack trace.
     
    adammpolak likes this.
  40. bobbaluba

    bobbaluba

    Joined:
    Feb 27, 2013
    Posts:
    81
    This was happening for me with the unity netcode sample project and 2020.1.3
     
  41. CityWizardGames

    CityWizardGames

    Joined:
    Nov 6, 2013
    Posts:
    21
    Happening to me in 1019.4.2f1. I think I crashed twice (windows build) because of it. Had success by lowering the quality level.
     
  42. adammpolak

    adammpolak

    Joined:
    Sep 9, 2018
    Posts:
    450
    @bobbaluba I am guessing you were working in the editor on Windows?

    Same was happening to me, then ran same code on Mac in editor, no more issue.

    @AurimasA
    2019.1.2
     
    bobbaluba likes this.
  43. bobbaluba

    bobbaluba

    Joined:
    Feb 27, 2013
    Posts:
    81
    Yes. Thanks for the tip, I do have a Linux install, so might solve it, but last I tried unity/rider there it was just too broken in other places.
     
    Last edited: Oct 18, 2020
  44. adammpolak

    adammpolak

    Joined:
    Sep 9, 2018
    Posts:
    450
    @AurimasA

    When rebuilding the netcode Asteroids multiplayer line by line the error appeared once introducing:

    [UpdateInGroup(typeof(ServerSimulationSystemGroup))]
    to LoadLevelSystem.cs to be run on the server
     
  45. adammpolak

    adammpolak

    Joined:
    Sep 9, 2018
    Posts:
    450
    @bobbaluba for some reason if you go through the sample logic line by line and try to rebuild Asteroids, once you get to LoadLevel.cs (in server) and add [UpdateInGroup(typeof(ServerSimulationSystemGroup))] it starts giving off the warning.
     
  46. adammpolak

    adammpolak

    Joined:
    Sep 9, 2018
    Posts:
    450
    @bobbaluba sorry for spamming you but thought you would want an update

    The warning randomly disappeared when I added some Debug.Log("note") to the code.

    It seems like there is no way to pinpoint or solve it, it comes and goes at it pleases. I am going to move forward ignoring the warnings. Let me know if you make any progress.
     
    bobbaluba likes this.
  47. 8bitgoose

    8bitgoose

    Joined:
    Dec 28, 2014
    Posts:
    448
    @adammpolak The error sometimes has to do with too high a framerate. Your mac machine may not be as powerful as your windows machine. Adding the debug.log kills it because your frame rate has dropped. The faster the FPS, the higher chance some internal Unity program has to not finish in 4 frames and spam that error.
     
    adammpolak likes this.
  48. adammpolak

    adammpolak

    Joined:
    Sep 9, 2018
    Posts:
    450
    @8bitgoose that is some good thinking!

    Does that go against the point that this warning should be ignored? Because I am fairly certain that my code is good and proper and that this comes with working with preview packages.
     
  49. 8bitgoose

    8bitgoose

    Joined:
    Dec 28, 2014
    Posts:
    448
    @adammpolak The warning should not be ignore since it causes issues performance problems spamming the console. Unity needs to track this down internally and fix it. Are you using any NativeArrays in your game?
     
  50. adammpolak

    adammpolak

    Joined:
    Sep 9, 2018
    Posts:
    450
    I was setting up the Asteroids sample from scratch. I am making a 3D version of it. Before I even got to native arrays the warning starting appearing.

    I was setting up LoadLevelSystem.cs (server side) and created an empty system with just `[UpdateInGroup(typeof(ServerSimulationSystemGroup))]` as a decorator and the warning started appearing. As soon as I commented it out, it disappeared.

    This was before I used NativeArrays :-(