Professional-Hobo / PokeMMOn-Old

MMO Pokemon Game using Node.js
http://keitharm.me/projects/pokemmon/
6 stars 2 forks source link

Weird double login issue #52

Closed keitharm closed 8 years ago

keitharm commented 8 years ago

Socket.io keeps logging in the user twice which ends up kicking the user from playing. No idea what is going on, but this problem seemed to happen after the PostgreSQL => MongoDB conversion

keitharm commented 8 years ago

I kind of found the bug, and it might explain why the double login issue happened 1% of the time in the past.

On line 111 of game.js, we make a socket connection when the game loop starts.

We also make a socket connection in init.js on line 9. When I comment out the game server socket connection, we don't get the double login issue anymore.

I think it was a race condition or something as to why it very rarely happened in the past with PostgreSQL. No idea why it'd start acting up like it is with MongoDB.

Nevertheless, we should use the same connection object in both init and game.js...will investigate more.