Search Unity

Cache Server 6.3.0 exits silently when trying to run from previous "cache_ram" data

Discussion in 'Cache Server' started by lasercannon, Jun 5, 2019.

  1. lasercannon

    lasercannon

    Joined:
    Nov 29, 2012
    Posts:
    70
    Hello,

    We've had our cache server with the RAM-backed module running for a few weeks now, and today I had to restart the server. The problem is that the cache server will not start up again (it closes with no log messages other than a message like "Cache path is 'H:/unity-cache/cache_ram'", UNLESS I clear out the page files from the cache folder. It seems that it's failing to load our previous cache state. What's going on here?

    For reference, here is the text of our config file. The biggest changes we made to the previous default.yml is the module type, cache paths, and maxPageCount from 10 to 100.

    Also for reference, I'm starting the cache server up by running 'unity-cache-server -nolegacy'. I've also tried just 'unity-cache-server'.

    Code (CSharp):
    1. Cache:
    2.   ## the cachePath key, if set, will override 'cachePath' within the individual module options below
    3.   # cachePath: "H:\unity-cache"
    4.   defaultModule: "cache_ram"
    5.   options:
    6.     processor:
    7.       putWhitelist: []
    8.     cache_ram:
    9.       cachePath: "H:/unity-cache/cache_ram"
    10.       pageSize: 100000000
    11.       maxPageCount: 100
    12.       minFreeBlockSize: 1024
    13.       persistence: true
    14.       persistenceOptions:
    15.         autosave: true
    16.         autosaveInterval: 10000
    17.         throttledSaves: false
    18.       highReliability: false
    19.       highReliabilityOptions:
    20.         reliabilityThreshold: 2
    21.         saveUnreliableVersionArtifacts: true
    22.         multiClient: false
    23.     cache_fs:
    24.       cachePath: "H:/unity-cache/cache_fs"
    25.       cleanupOptions:
    26.         expireTimeSpan: "P30D"
    27.         maxCacheSize: 0
    28.       persistence: true
    29.       persistenceOptions:
    30.         autosave: true
    31.         autosaveInterval: 10000
    32.         throttledSaves: false
    33.       highReliability: false
    34.       highReliabilityOptions:
    35.         reliabilityThreshold: 2
    36.         saveUnreliableVersionArtifacts: true
    37.         multiClient: false
    38. Mirror:
    39.   addresses: []
    40.   options:
    41.     queueProcessDelay: 2000
    42.     connectionIdleTimeout: 10000
    43. Server:
    44.   port: 8126
    45.   options:
    46.     allowIpv6: false
    47. Global:
    48.   logLevel: 3
     
  2. lasercannon

    lasercannon

    Joined:
    Nov 29, 2012
    Posts:
    70
    New findings:

    • Still happens when "persistent" is false
    • Still happens when increasing maxPageCount
    • Just tried running the cleanup script, and I get the following error, which may have something to do with it:

    Code (CSharp):
    1. C:\Users\Administrator>unity-cache-server-cleanup
    2. Cache path is H:/unity-cache/cache_ram
    3. Error: Duplicate key for property fileId: 352db1b773d4b474b980de13593fc73d-aab3c2afb47c9381dc29b4de66a9a3c5-i
    4.     at UniqueIndex.set (C:\Users\Administrator\AppData\Roaming\npm\node_modules\unity-cache-server\node_modules\lokijs\src\lokijs.js:7246:17)
    5.     at C:\Users\Administrator\AppData\Roaming\npm\node_modules\unity-cache-server\node_modules\lokijs\src\lokijs.js:5439:15
    6.     at Array.forEach (<anonymous>)
    7.     at Collection.ensureUniqueIndex (C:\Users\Administrator\AppData\Roaming\npm\node_modules\unity-cache-server\node_modules\lokijs\src\lokijs.js:5438:17)
    8.     at Loki.loadJSONObject (C:\Users\Administrator\AppData\Roaming\npm\node_modules\unity-cache-server\node_modules\lokijs\src\lokijs.js:1728:22)
    9.     at Loki.loadJSON (C:\Users\Administrator\AppData\Roaming\npm\node_modules\unity-cache-server\node_modules\lokijs\src\lokijs.js:1626:12)
    10.     at loadDatabaseCallback (C:\Users\Administrator\AppData\Roaming\npm\node_modules\unity-cache-server\node_modules\lokijs\src\lokijs.js:2515:20)
    11.     at readFileCallback (C:\Users\Administrator\AppData\Roaming\npm\node_modules\unity-cache-server\node_modules\lokijs\src\lokijs.js:2327:15)
    12.     at FSReqWrap.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:53:3)
    So it seems to be a crash caused by duplicate keys in a dictionary.

    This is pretty frustrating, since at some point our cache server crashes, and the only way to start it back up is to destroy all of our cache data. We switch platforms frequently (including consoles) so this is slowing us down a lot.
     
  3. Reichert

    Reichert

    Unity Technologies

    Joined:
    Jun 20, 2014
    Posts:
    63
    Thanks for the report. We'll track the bug and continue the discussion in the GitHub repo.