HA! Fixed it.
It looks like you're trying to save a character as it's logging in. It's occurring within DoLogin (probably as it's changing the character's online status). This might be a sign that your database isn't thread safe or that you're saving something incorrectly. It's hard to tell though. You should debug it by outputting messages as it saves information. That way, you'll know what line it's having a problem with. Good luck!