Bug fix related to timeouts

Some users have reported difficulties staying connected to Shmeppy. I pushed a fix about 20 minutes ago that will hopefully resolve this problem for all users.

This is a tricky kind of bug to properly hunt down and fix, because it’s hard to tell whether I’ve actually fixed the problem. But I’ll share what I think is causing this, what I’ve done to fix it, and how I’ll know for sure that it’s fixed (after some time has passed).

What I think is causing this

First thing to know: when your connected to Shmeppy, your computer is sending a simple message “PING” every 2 seconds. Shmeppy will always respond promptly with “PONG”. If your computer is late sending its required “PING” or Shmeppy is late replying with “PONG”, the connection is killed and your computer will try to reconnect.

Second thing to know: When a user connects to a game, Shmeppy sends them the entire history of the game. This can be pretty big, and more importantly, it can take awhile for Shmeppy’s servers to actually retrieve the entire history of the game from the database.

Because of a bug in Shmeppy’s code, your computer does not even try to send “PING” messages before its gotten the entire history of the game from Shmeppy. So the connection can be improperly killed if Shmeppy takes too long sending the history of the game.

What I’ve done to fix it

I’ve made sure that your computer knows to always send “PING” messages. Even before it has the history of the game.

How I’ll know for sure it’s fixed

The way I found the problem was by doing some statistical analysis on my log files. Specifically, I generated these three charts:

21%20PM

29%20PM

You can see that despite the number of users seen each day (represented by unique analytic IDs) staying roughly static, the number of connections that are killed because of timeouts are increasing exponentially.

If what I’ve done today actually fixed the problem, that second graph should drop very dramatically. Unfortunately I’ll need to wait at least a day or two before I can actually see whether that has happened.

Keep your fingers crossed!

Special thanks to Attlo and Jwales on Discord for reporting this bug. They mentioned that they and their players were having trouble staying connected to Shmeppy last night, which prompted me to dive into this analysis and ultimately come up with a fix. Thanks to you both!