Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

warning: <x> FS.syncfs operations in flight at once, probably just doing extra work

Discussion in 'Web' started by Aurigan, Dec 21, 2016.

  1. Aurigan

    Aurigan

    Joined:
    Jun 30, 2013
    Posts:
    291
    I'm getting an old game running on webGL for the first time ever, using Unity 5.5p1. So far I have everything working but the (chrome) console every 8 seconds is spitting out 3 warnings:

    warning: 2 FS.syncfs operations in flight at once, probably just doing extra work
    warning: 3 FS.syncfs operations in flight at once, probably just doing extra work
    warning: 4 FS.syncfs operations in flight at once, probably just doing extra work

    From a quick google search FS.syncfs appears to be something to do with the javascript / indexed db filesystem so presumably *something* is doing a file op 4x at the same time ... I have no idea what that might be though, still happens after disabling save games (which use player prefs).

    Has anyone seen this / have a solution for it?
     
    twobob likes this.
  2. Arsinx

    Arsinx

    Joined:
    Apr 14, 2014
    Posts:
    55
    I recently built a game for webgl using 5.5 and i am getting the same warnings as soon as the unity logo appears after which it gets stuck there, if any one knows how to solve this issue it will be really appreciated.
     
    twobob likes this.
  3. DSL-TailorIt

    DSL-TailorIt

    Joined:
    Jan 2, 2017
    Posts:
    6
    This warning also appears in my builds, although it doesn't prevent me from actually using my application.

    In my case I think it might have something to do with loading AssetBundles, but I haven't verified it yet.

    I worry more about warnings than actual errors, so if anyone knows something about this, I would be also be thankful to get some possible solution.

    Thanks in advance :)
     
    twobob likes this.
  4. Aurigan

    Aurigan

    Joined:
    Jun 30, 2013
    Posts:
    291
    bump! getting this in a completely new game also
     
    twobob likes this.
  5. Schubkraft

    Schubkraft

    Unity Technologies

    Joined:
    Dec 3, 2012
    Posts:
    1,075
    This seems to be harmless, we'll look into it though.
     
    XUJIE_HAH, twobob, Zaelot and 2 others like this.
  6. Aurigan

    Aurigan

    Joined:
    Jun 30, 2013
    Posts:
    291
    Thank you - it DOES appear to be harmless in practice but vexing to have unneeded log spam.
     
    twobob likes this.
  7. AzureByte

    AzureByte

    Joined:
    Apr 25, 2017
    Posts:
    2
    For me I think this is a symptom of another problem. I am getting random fps drops throughout the game while running a WebGL build in browser. No performance issues on mobile/PC builds
     
  8. 3DNewsman

    3DNewsman

    Joined:
    Nov 3, 2012
    Posts:
    14
    Bumping this. We've had it on our app for a long time, and seems like it would be helpful to get to the bottom of it.
     
    twobob likes this.
  9. therealao

    therealao

    Joined:
    Feb 13, 2017
    Posts:
    5
    Bump, I've a feeling this is causing some performance issues. I'm only getting about 25% of the framerate of a native x86-64 build in WebGL, for a much smaller scene.. Any insight would be greatly appreciated
     
  10. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,654
    how many "FS.syncfs operations..." warnings are you seeing? just a few or a continuous flow?

    The gap in performance might be simply be caused by the fact that Unity WebGL is single-threaded at the moment.
     
    twobob likes this.
  11. hromoyDron

    hromoyDron

    Joined:
    Jan 24, 2013
    Posts:
    90
    I have the same message (unity 2017.3)

    When I start using AssetBundleManager I see much more warnings

    What to do?
     
  12. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,654
    If everything works well, do nothing :)
     
    hromoyDron likes this.
  13. keeves_test14

    keeves_test14

    Joined:
    Dec 5, 2016
    Posts:
    13
    Hi, I'm using unity 5.6.3f3 and when I run webgl build I'm getting the following warning.

    warning: 2 FS.syncfs operations in flight at once, probably just doing extra work.

    I've AI player in my game,when AI turn occurs, the warning is occured and ai player can't take its move for this.Please help me to solve the issue.
     
    twobob likes this.
  14. ProgrammingWhileSleeping

    ProgrammingWhileSleeping

    Joined:
    Nov 10, 2017
    Posts:
    17
    Hi, I have found a solution but I'm not sure I could say this is a great one, it would disable all the logging and it would only work for WebGL. Just add these lines of code before the game is instantiated.


    var DEBUG = false;
    if(!DEBUG){
    if(!window.console) window.console = {};
    var methods = ["log", "debug", "warn", "info"];
    for(var i=0;i<methods.length;i++){
    console[methods] = function(){};
    }
    }

    Source: https://stackoverflow.com/questions...disable-all-console-log-statements-in-my-code

    WARNING: This will completely remove all console logs, so if you have any intended clues for the game in the logs, then it would not be recommended.
     
    yaezah and twobob like this.
  15. ProgrammingWhileSleeping

    ProgrammingWhileSleeping

    Joined:
    Nov 10, 2017
    Posts:
    17
    Full code in case anyone gets confused with my answer, just replace your index.html code with this:

    <!DOCTYPE html>
    <html lang="en-us">
    <head>
    <meta charset="utf-8">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>Unity WebGL Player | Your Title</title>
    <link rel="shortcut icon" href="TemplateData/favicon.ico">
    <link rel="stylesheet" href="TemplateData/style.css">
    <script src="TemplateData/UnityProgress.js"></script>
    <script src="Build/UnityLoader.js"></script>
    <script>
    var DEBUG = false;
    if(!DEBUG){
    if(!window.console) window.console = {};
    var methods = ["log", "debug", "warn", "info"];
    for(var i=0;i<methods.length;i++){
    console[methods] = function(){};
    }
    }
    var gameInstance = UnityLoader.instantiate("gameContainer", "Build/Your Title.json", {onProgress: UnityProgress});
    </script>
    </head>
    <body>
    <div class="webgl-content">
    <div id="gameContainer" style="width: 960px; height: 600px"></div>
    <div class="footer">
    <div class="webgl-logo"></div>
    <div class="fullscreen" onclick="gameInstance.SetFullscreen(1)"></div>
    <div class="title">Your Title</div>
    </div>
    </div>
    </body>
    </html>
     
    twobob and unknownsk like this.
  16. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    Hmmm.. this seems like a nothing error all in. that said. Roll-on threading

    EDIT: and yes, I have it too
     
  17. VMS_Lab

    VMS_Lab

    Joined:
    Dec 31, 2013
    Posts:
    3
    I think this error is related to my game crashing in WebGL. When I do a build with No Exceptions enabled my the game crashes in the browser. When I do a build with Full Exceptions enabled this error is the first pop up and and the game loads fine. No other exceptions are thrown. Could this error cause a game to crash?
     
  18. emirkoskenli

    emirkoskenli

    Joined:
    Oct 7, 2018
    Posts:
    5
    Looks like this error causing high CPU usage and my game getting slower in time. It is continuous flow at console.
    "warning: 65 FS.syncfs operations in flight at once, probably just doing extra work"
    Spammed this error like 60-100 times in a minute. Searched google but no luck.
     
  19. hsallander

    hsallander

    Joined:
    Dec 19, 2013
    Posts:
    46
    Hi all, we're seeing this issue as well in our WebGL game, using Unity 2019.2. Any progress on this issue, or a workaround we can use, @Marco-Trivellato or @Schubkraft ?
     
  20. jukka_j

    jukka_j

    Unity Technologies

    Joined:
    May 4, 2018
    Posts:
    953
    FS.syncfs() is triggered by a call that either saves or loads persistent content to IndexedDB. I am not sure exactly which all Unity APIs can trigger this, but look for a connection with PlayerPrefs, writing to disk/filesystem or asset bundles.

    The warning itself is not about anything bad/incorrect happening, but it is a performance warning of redundant work that occurs - a previous save/load operation has not yet finished, but a new save/load operation is already being attempted.
     
  21. TheJimz

    TheJimz

    Joined:
    Jun 26, 2015
    Posts:
    50
    Sounds like this warning itself is causing a lot more slowdown than what it's warning about. Can we please disable it?
     
  22. jukka_j

    jukka_j

    Unity Technologies

    Joined:
    May 4, 2018
    Posts:
    953
    You can disable the warning by editing C:\Program Files\Unity\Hub\Editor\<unity_version>\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\Emscripten\src\library_fs.js around line ~496, delete line

    console.log('warning: ' + FS.syncFSRequests + ' FS.syncfs operations in flight at once, probably just doing extra work');
     
  23. forzabo

    forzabo

    Joined:
    Aug 28, 2015
    Posts:
    64
    For any one on macOS (like me) wondering where this file is:

    /Applications/Unity/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/src/library_fs.js

    Commenting out lines 495-497 does the trick.
     
  24. dblaw

    dblaw

    Joined:
    Oct 16, 2020
    Posts:
    9
    As a potential help to others who may be googling this:

    I had the same problem. Things fine in the editor, crash in WebGL, when turning on the warnings things worked fine with the error "FS.syncfs operations" as described here.

    I had been using a .Find on a game object (I know I know). But, that game object was not there because I had moved things around and renamed stuff. Getting rid of my bad .Find fixed things right up. Really wish there would have been some kind of error telling me what I had done.
     
  25. salqadri

    salqadri

    Joined:
    Nov 1, 2013
    Posts:
    7
    I see this warning as well. If this should not be a warning, how about not use the word 'warning' in the log, or better yet, how about Unity get rid of that message unless you can give concrete documentation on why this message is something we should act on and how.
     
    legoesbenr likes this.
  26. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058

    HOW ABOUT YOU READ UP - ABOUT 3 MESSAGES.
    since we all so keen to be shoutily telling other what to do.


    jukka_j

    Unity Technologies

    States very clearly what it is - why it is - and what you can do.
     
  27. mickfcna

    mickfcna

    Joined:
    May 13, 2019
    Posts:
    46
    Got the same error on Unity 2019.4, any update ?
     
  28. sebj

    sebj

    Joined:
    Dec 4, 2013
    Posts:
    70
    In our game, the number of FS.syncFSRequests increases continuously (up to the thousands over an hour or so). Is that also expected or are we leaking something?
     
  29. EduTech_dev

    EduTech_dev

    Joined:
    Oct 13, 2022
    Posts:
    1
    I solved the issue by just limiting the FPS to 30p/second.

    Application.targetFrameRate = targetFrameRate;
     
  30. ExNinja

    ExNinja

    Joined:
    Dec 4, 2013
    Posts:
    31
  31. kenorbik

    kenorbik

    Joined:
    Jan 9, 2023
    Posts:
    7
    Same warning, and nothing loads, stuck on the black screen.

    Code (Boo):
    1. Initialize engine version: 2021.3.16f1 (4016570cf34f)
    2. [UnityCache] 'http://localhost:8000/Build/WebGL.data' successfully revalidated and served from the indexedDB cache
    3. WebGL.loader.js:80
    4. warning: 2 FS.syncfs operations in flight at once, probably just doing extra work
    5.  
    6. printErr @ WebGL.loader.js:80
    7. syncfs @ WebGL.framework.js:5329
    8. sync @ WebGL.framework.js:1641
    9. (anonymous) @ WebGL.framework.js:1650
    10. setInterval (async)
    11. setInterval @ WebGL.loader.js:66
    12. _JS_FileSystem_Initialize @ WebGL.framework.js:1649
    13. $main @ WebGL.wasm:0x22d13c5
    14. (anonymous) @ WebGL.framework.js:1060
    15. callMain @ WebGL.framework.js:18515
    16. doRun @ WebGL.framework.js:18558
    17. run @ WebGL.framework.js:18570
    18. runCaller @ WebGL.framework.js:18498
    19. removeRunDependency @ WebGL.framework.js:1015
    20. (anonymous) @ WebGL.loader.js:1104
    21.  
     
  32. keli_laerdal

    keli_laerdal

    Joined:
    Jun 16, 2020
    Posts:
    1
    I've been hit by this bug as well and tracked the problem down to the sync(onlyPendingSync) method inside .../WebGLSupport/BuildToos/lib/FileSystem.js

    The problem is when the onlyPendingSync parameter is true, the method is supposed to only run if there were syncRequests pending while a previous sync was running. The solution is to ensure that in addition to having pending syncs, it should also ensure that the ongoing fsync is not running. Here's a patch that should fix the problem:

    Code (JavaScript):
    1.  
    2. --- old/FileSystem.js   2023-04-18 15:23:34.885222700 +0200
    3. +++ new/FileSystem.js   2023-04-18 15:24:12.256876100 +0200
    4. @@ -7,7 +7,7 @@
    5.         sync : function(onlyPendingSync)
    6.         {
    7.                 if (onlyPendingSync) {
    8. -                       if (fs.numPendingSync == 0)
    9. +                       if (fs.syncInProgress || fs.numPendingSync == 0)
    10.                                 return;
    11.                 }
    12.                 else if (fs.syncInProgress) {
    13.  
    Edit: Regarding whether this bug is harmless, it seems that it could be serious, as the original pending/inProgress hack is to work around a potential memory leak inside indexedDB, according to a comment in that file:
    Code (JavaScript):
    1.  
    2. else if (fs.syncInProgress) {
    3.             // this is to avoid indexedDB memory leak when FS.syncfs is executed before the previous one completed.
    4.             fs.numPendingSync++;
    5.             return;
    6.         }
    7.  
    8.  
    9.  
    Update 05.15 I submitted a bug report with this patch, which got rejected without consideration due to not being "reprducible" I replied with a link to this thread.
     
    Last edited: May 15, 2023
    legoesbenr and samuel-levine like this.
  33. JanetGilbertPraxis

    JanetGilbertPraxis

    Joined:
    May 6, 2022
    Posts:
    22
    It happens on all our WebGL builds, a lot. Very reproducible.
     
  34. JanetGilbertPraxis

    JanetGilbertPraxis

    Joined:
    May 6, 2022
    Posts:
    22
    We can't edit this file as we use Cloud build.
     
    legoesbenr likes this.
  35. Leonova0

    Leonova0

    Joined:
    Dec 14, 2022
    Posts:
    1
    Seems like no body is working on this....
     
  36. AritaDev

    AritaDev

    Joined:
    Aug 13, 2019
    Posts:
    13
    I also encountered the same problem. I solved it by turning off parallel download tasks.
    I guess if Unity WebGL has multiple tasks in IO or IndexDB processing at the same time, this log will be issued. Such as downloading files in parallel, resulting in parallel writing to IndexDB.
    I changed the parallel download to serial and there is no such log
     
  37. jukka_j

    jukka_j

    Unity Technologies

    Joined:
    May 4, 2018
    Posts:
    953
    I audited the code path in question in detail today, and even though there was an old comment about a memory leak, that comment was stale from nearly a decade ago.

    The message can be safely ignored, or if you would like to remove it, the earlier post helps to do that.

    The root source of the "X FS.syncfs operations in flight at once, probably just doing extra work" message comes from an external codebase that is not authored by Unity ( https://github.com/emscripten-core/...a0fc0eeb91f60c5b6682cb/src/library_fs.js#L504 ), which is why controlling it in-house has had such friction for a long time.

    However you all do bring up good points that the message should not be posted in the first place if it does not mean anything, since it will then be just a red herring to diagnosing some other more important issues. I have now authored a fix PR that will clean the warning away altogether, that should help resolve this topic for good. Thanks for persisting with the comments!
     
  38. legoesbenr

    legoesbenr

    Joined:
    Apr 27, 2022
    Posts:
    10
    Running LTS 2021.3.16f1 and this is till a problem. As a developer I don't understand how hiding the error can ever be considered a fix.
    Just because the error is in a 3rd party library, does not remove the responsibility of the consumer (Unity), distributing it.
    This bug is so old and there is even a fix for it posted. But us using Cloud Build can't leverage from that.
    I strongly suggest that Unity pick this up and resolve it, either by addressing to the vendor of the third party library, contributing or deploying the above fix to Unity distributions.

    We get this error massively. The console is spammed heavily, so it is a "biggy".
     
  39. legoesbenr

    legoesbenr

    Joined:
    Apr 27, 2022
    Posts:
    10
    Where do you configure parallel vs. serial download?
     
  40. kaluga1

    kaluga1

    Joined:
    Dec 1, 2022
    Posts:
    4
    Please someone answer, i've been searching in google for this parallel download tasks or parallel download to serial and nothing appears...

    I found this: https://docs.unity3d.com/Manual/JobSystemParallelForJobs.html
    But doesnt show how to disable, just to create
     
  41. AritaDev

    AritaDev

    Joined:
    Aug 13, 2019
    Posts:
    13
    Sorry for confusion, I mean in my case I have called UnityWebRequest.Download multiple times within a short time and it will start parallel download tasks. So I ensure to call UnityWebRequest.Download one by one in order to keep only one download task is excuted at the same time.