No game ticks occur, can't connect to storage



  • No game ticks are occurring on my local server; i.e., I can start the server, connect to it with the client, and place a Spawn, but nothing happens; my scripts are not run, my Safe Mode timer does not decrement.

    Numerous errors are shown in the server console, unfortunately it doesn't seem possible to copy & paste from these (are these available as files anywhere?)

    These include: 

    - "Storage connection lost { Error: connect ECONNREFUSED 127.0.0.1:21027...

    - TypeError: Cannot read property 'clear' of undefined at Array.sendNotifications...

    - Unhandled rejection: Error: Can't set headers after they are sent

    Running under Steam client on Mac OSX 10.12.1


  • Dev Team

    Logs are located in server/logs in your Steam installation folder. Are there any errors in the storage log?



  • Thanks Artem - the server seems to think it's getting connections:

    Loading mods in 'mods'
    Starting storage server
    Storage listening on 21027
    [127.0.0.1:50064] Incoming connection
    [127.0.0.1:50065] Incoming connection
    [127.0.0.1:50066] Incoming connection
    [127.0.0.1:50067] Incoming connection
    [127.0.0.1:50068] Incoming connection
    [127.0.0.1:50072] Incoming connection

    (that's it!)



  • This is engine_main.log though:

    Loading mods in 'mods'
    Connecting to storage
    Storage connection lost { Error: connect ECONNREFUSED 127.0.0.1:21027
    at Object.exports._errnoException (util.js:1026:11)
    at exports._exceptionWithHostPort (util.js:1049:20)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1081:14)
    code: 'ECONNREFUSED',
    errno: 'ECONNREFUSED',
    syscall: 'connect',
    address: '127.0.0.1',
    port: 21027 }
    Connecting to storage
    Storage connection lost { Error: connect ECONNREFUSED 127.0.0.1:21027
    at Object.exports._errnoException (util.js:1026:11)
    at exports._exceptionWithHostPort (util.js:1049:20)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1081:14)
    code: 'ECONNREFUSED',
    errno: 'ECONNREFUSED',
    syscall: 'connect',
    address: '127.0.0.1',
    port: 21027 }
    Connecting to storage



  • I am experiencing the same problem on my server.
    I have made a support request with the details, including log files.

    For me, restarting the server solves the problem for a while, but after some time it happens again.



  • Was a fix for this ever discovered?  I am having the exact same problem.  Servers starts and a minute or two later storage exits with null and the game stops.



  • I've also encountered the same issue although in my case the server would run quite a ways before hitting the issue. The logs show:

    engine_main.log (excerpt):

    Game time set to 32477
    Main loop reset! Stage: waitForUsers
    Main loop reset! Stage: waitForRooms
    Game time set to 32478
    Main loop reset! Stage: waitForUsers
    Main loop reset! Stage: waitForUsers
    Main loop reset! Stage: addRoomsToQueue
    Main loop reset! Stage: global
    Storage connection lost { Error: read ECONNRESET
        at _errnoException (util.js:992:11)
        at TCP.onread (net.js:618:25) code: 'ECONNRESET', errno: 'ECONNRESET', sysca
    ll: 'read' }
    Connecting to storage
    Storage connection lost { Error: connect ECONNREFUSED 127.0.0.1:21027
        at Object._errnoException (util.js:992:11)
        at _exceptionWithHostPort (util.js:1014:20)
        at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1186:14)
      code: 'ECONNREFUSED',
      errno: 'ECONNREFUSED',
      syscall: 'connect',
      address: '127.0.0.1',
      port: 21027 }
    Connecting to storage
    Storage connection lost { Error: connect ECONNREFUSED 127.0.0.1:21027
        at Object._errnoException (util.js:992:11)
        at _exceptionWithHostPort (util.js:1014:20)
        at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1186:14)
      code: 'ECONNREFUSED',
      errno: 'ECONNREFUSED',
      syscall: 'connect',
      address: '127.0.0.1',
      port: 21027 }
    Main loop reset! Stage: global
    Connecting to storage
    Main loop reset! Stage: global
    Main loop reset! Stage: global
    Main loop reset! Stage: global
    

    the same message continues indefinately from there

    storage.log:

    screeps@sosscreeps2:~/world/logs/1527233603197$ cat storage.log | more
    Loading mods from "/home/screeps/world/mods.json"
     - /home/screeps/world/example-mods/welcome-text.js
    Starting storage server
    Storage listening on 21027
    [127.0.0.1:51744] Incoming connection
    [127.0.0.1:51746] Incoming connection
    [127.0.0.1:51748] Incoming connection
    [127.0.0.1:51750] Incoming connection
    [127.0.0.1:51758] Incoming connection
    /home/screeps/world/node_modules/lokijs/src/lokijs.js:2158
                throw err;
                ^
    
    Error: ENOENT: no such file or directory, rename 'db.json~' -> 'db.json'
    Loading mods from "/home/screeps/world/mods.json"
     - /home/screeps/world/example-mods/welcome-text.js
    Starting storage server
    Storage listening on 21027
    [127.0.0.1:41278] Incoming connection
    [127.0.0.1:41280] Incoming connection
    [127.0.0.1:41282] Incoming connection
    [127.0.0.1:41284] Incoming connection
    [127.0.0.1:41286] Incoming connection
    

    In lokijs the relevant source for that error is:

    /**
     * Handles saving to file system, local storage, or adapter (indexeddb)
     *    This method utilizes loki configuration options (if provided) to dete$
     *    persistence method to use, or environment detection (if configuration$
     *
     * @param {function=} callback - (Optional) user supplied async callback / $
     * @memberof Loki
     */
    Loki.prototype.saveDatabase = function (callback) {
      var cFun = callback || function (err) {
          if (err) {
            throw err; // <-- error thrown here
          }
          return;
        },
        self = this;
    
      // the persistenceAdapter should be present if all is ok, but check to be$
      if (this.persistenceAdapter !== null) {
        // check if the adapter is requesting (and supports) a 'reference' mode$
        if (this.persistenceAdapter.mode === "reference" && typeof this.persist$
          // filename may seem redundant but loadDatabase will need to expect t$
          this.persistenceAdapter.exportDatabase(this.filename, this.copy({remo$
            self.autosaveClearFlags();
            cFun(err);
          });
        }
        // otherwise just pass the serialized database to adapter
        else {
          this.persistenceAdapter.saveDatabase(this.filename, self.serialize(),$
            self.autosaveClearFlags();
            cFun(err);
          });
        }
      } else {


  • I restarted my server which eliminated the issue for the moment, though I suspect it will reoccur at some point. I also experimented on a separate VM and confirmed I could bring down the engine_main process in isolation and then have the launcher spin it back up with additional custom logging inside that loop. If the problem does reproduce and restarting the engine_main process doesn't eliminate it then I should be able to learn more next time.