About 10 times a day I see an error like
Memory segment #1 has exceeded 100 KB length limit
The penultimate statement in my main.loop is
console.log("debug segment lengths:", _.map(RawMemory.segments, (s) => s ? s.length : 0));
So just before I get this error, my debug statement logs that segments 0-8 all have a length of 102400 characters. So they are exactly at the 100KB length limit.
2018-08-15 19:31:49 shard2: debug segment lengths: 102400,102400,102400,102400,102400,102400,102400,102400,102400
Error:shard2: Memory segment #1 has exceeded 100 KB length limit
So every tick I'm storing several segments containing 102400 characters of data, but a few times a day I get this error that the data was actually longer than 102400 characters (even though I just logged the segment length!)
I've recently started storing wider string data in my segments - that is, I'm using some unicode characters that are beyond ASCII. Is it possible that the memory segment - after the game serialises it into the database at the end of the tick, then unserialises it at the beginning of the following tick - ends up expanding to a new string that isn't identical to the previous string and is longer than 102400 characters?