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 {