HostedRedmine.com has moved to the Planio platform. All logins and passwords remained the same. All users will be able to login and use Redmine just as before. Read more...
Server can hang in find_dispersed_position() if scenario has invalid start position
While doing task #767082, I found the server would usually hang when I started Peter Weber's old Europe map (file too old for 2.6). Coredump showed it was in find_dispersed_position(). Reducing aifill made it less likely to happen.
find_dispersed_position() has no bail-out. That map has some start positions in the sea, and no dispersion configured, so if the start position is chosen, find_dispersed_position() is inevitably going to hang forever.
Probably find_dispersed_position() should have some sort of bail-out threshold (which could be reduced to 1 for the special case of game.server.dispersion==0).
Not sure what should happen if we hit the bail-out. In other failure cases nearby in init_new_game(), the game silently drops that player's starting unit, which doesn't seem very fair (especially if that was the only city founder in the pack!); there's only a complaint if a player gets no units at all. Probably we should at least warn the player in all these cases, and maybe tell everyone and/or abort the game (although there's no abort code path here currently).
Possibly we should also make it harder to inadvertently create scenarios with unusable start positions, since it's quite easy to miss in testing. Not sure how, exactly.
#6 Updated by Marko Lindqvist over 1 year ago
- File 0054-Bail-out-from-find_dispersed_position-if-no-tile-fou.patch 0054-Bail-out-from-find_dispersed_position-if-no-tile-fou.patch added
- Status changed from New to Resolved
Attached patch implements just the find_dispersed_position() bailout. Will open new tickets about the rest.
#8 Updated by Marko Lindqvist over 1 year ago
- Status changed from Resolved to In Progress
Number of attempts (20) in the patch is really low - with almost any value of dispersion that's even less than number of tiles in the area, i.e., even if every attempt hit different tile, not all tiles would be tested.
#9 Updated by Marko Lindqvist over 1 year ago
- File 0017-Bail-out-from-find_dispersed_position-if-no-tile-fou.patch 0017-Bail-out-from-find_dispersed_position-if-no-tile-fou.patch added
- Status changed from In Progress to Resolved
- Calculate more sensible max number of attempts before bailing out