View unanswered posts | View active topics It is currently Fri May 23, 2025 10:11 am



Reply to topic  [ 3 posts ] 
 Fixing race conditions in GL database 
Author Message
User avatar

Joined: Tue Aug 10, 2010 8:40 pm
Posts: 1671
Reply with quote
Providing technical suggestion here, due to recent abuse that I won't go into. The problem with all game requests is not processing them sequentially for any particular player; therefore, I would recommend converting mySQL to innoDB instead of MyISAM and doing row level locking. The other solution is to queue requests made by the same player, but this is hard with PHP + MySQL. You want all game states updated before processing the next requests, so that the game logic will reject requests that are no longer valid (usually, exceeding a game counter or limit). This should also fix multiple base+boss drops which actually happens without anyone trying if there are a lot of people hitting it at the same time (again, parallel requests). If you lock the correct data related to a game request, it should prevent race conditions that result in unexpected game behaviors since the next request will only be processed in the database once the prior one is completed.

_________________
Ex cinere surget iterum ego galaxiae dominatur.
Image


Sun Jan 08, 2012 4:58 am
Profile

Joined: Fri Nov 19, 2010 9:51 pm
Posts: 85
Reply with quote
Yeah, this seems the clearest sure way to fix all these bugs to me as well. This is what I've been suggesting for like a year every time someone brings up a new bug based on this design flaw (which is basically the cause of 95% of all the bugs that have ever existed in this game). You implement locking and then create a locked/action denied handler for the front-end. It would create more delays/lag when doing things like attacking bases since I doubt the DB (given that most hosted DBs are slow as snot) could keep up with the current transaction speeds involved in large base combat but that could be alleviated by say adding a 50 energy attack button that does 10 attacks at once or something to reduce the queries.


Sun Jan 08, 2012 6:20 am
Profile

Joined: Fri Nov 19, 2010 9:51 pm
Posts: 85
Reply with quote
This isn't necessarily the only way to fix it however just perhaps the most certain to avoid future similar bugs. The database semaphore style suggested http://galaxylegion.com/forum/viewtopic.php?f=7&t=18651 would also work. Or if the system runs some kind of master thread on the server you could do software semaphores instead of database semaphores like you would in a multi-threaded environment. Just throwing ideas out there to try and help get this taken care of.


Sun Jan 08, 2012 6:55 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 3 posts ] 

Who is online

Users browsing this forum: No registered users and 13 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software.