Oh, I've been studying this; I used to have these issues until I engineered a fix for my end.
What I've noticed:
It seems to happen in batches; when running turns on two mafia instances at once, they both lag at the same time.
Inside of mafia, you can replicate the issue by equipping/unequipping a hat over and over in a script until you have Problems. Or maybe just visiting main.php.
It's possible to replicate outside of mafia using
httping. Run it for a long enough time, and you'll start to get timeout errors, something like 0.5% of the time:
Code:
%./httping -v "https://www.kingdomofloathing.com/login.php?loginid="
Connecting to 107.23.63.16...
connected to 107.23.63.16:443 (154 bytes), seq=48 time= 86.00 ms
Connecting to 107.23.63.16...
connected to 107.23.63.16:443 (154 bytes), seq=49 time= 87.16 ms
Connecting to 107.23.63.16...
connected to 107.23.63.16:443 (154 bytes), seq=50 time= 89.01 ms
Connecting to 107.23.63.16...
connect time out
[...]
Connecting to 54.89.140.139...
connected to 54.89.140.139:443 (154 bytes), seq=719 time= 86.57 ms
Connecting to 54.89.140.139...
connected to 54.89.140.139:443 (154 bytes), seq=720 time=100.80 ms
Connecting to 54.89.140.139...
connected to 54.89.140.139:443 (154 bytes), seq=721 time= 89.64 ms
Connecting to 54.89.140.139...
connect time out
You may need to ping "https://www.kingdomofloathing.com/login.php?loginid=" specifically, rather than "https://www.kingdomofloathing.com/".
I edited httping to output which IP it was connecting to, even during a timeout error. This allowed me to discover that two of the four IPs KOL uses have errors, and two don't.
Erroring IPs:
Code:
54.89.140.139
107.23.63.16
Non-erroring IPs: (so far)
Code:
3.225.18.117
18.214.149.52
I tracerouted all of those IPs, and they seem to take two sets of routes. One set for the erroring IPs, and one for the non-erroring IPs.
As such, I suspect the issue could be:
-Those two frontends are bad, and only certain people have issues?
-There's an issue somewhere in the internet, that only affects certain routes and certain ISPs?, that causes connections to break in ways TCP doesn't like.
-A bad AWS availability zone, where those two IPs are hosted, and the other two are in another zone...?
I don't have enough network knowledge to think of other ways.
It's possible to mitigate the issues by editing your /etc/hosts file, to only connect to a "stable" server:
Code:
3.225.18.117 www.kingdomofloathing.com
But that isn't a useful fix for everyone. Actually, mafia itself could just blacklist the two bad IPs. Or the game devs could shut those servers off.