Project

Profile

Help

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...

Bug #767127

Server can hang in find_dispersed_position() if scenario has invalid start position

Added by Jacob Nevins about 3 years ago. Updated 5 months ago.

Status:
Closed
Priority:
Normal
Category:
Server
Sprint/Milestone:
Start date:
Due date:
% Done:

0%

Estimated time:

Description

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.


Related issues

Related to Freeciv - Task #767082: Refresh old isometric maps and put them on modpack serverClosed

<a title="Actions" class="icon-only icon-actions js-contextmenu" href="#">Actions</a>
Related to Freeciv - Bug #767129: Nation-specific starting units can start on non-native terrain, or on hut tileClosed

<a title="Actions" class="icon-only icon-actions js-contextmenu" href="#">Actions</a>

History

#1 Updated by Jacob Nevins about 3 years ago

  • Related to Task #767082: Refresh old isometric maps and put them on modpack server added

#2 Updated by Jacob Nevins about 3 years ago

I think this is what Daniel Markstedt previously reported (with this scenario) in RT PR#39755 (2007).

#3 Updated by Jacob Nevins about 3 years ago

  • Related to Bug #767129: Nation-specific starting units can start on non-native terrain, or on hut tile added

#4 Updated by Jacob Nevins about 3 years ago

  • Subject changed from Server can hang in find_dispersed_position() if scenario has invalid position to Server can hang in find_dispersed_position() if scenario has invalid start position

#5 Updated by Marko Lindqvist 6 months ago

  • Sprint/Milestone set to 2.6.5

#6 Updated by Marko Lindqvist 5 months ago

Attached patch implements just the find_dispersed_position() bailout. Will open new tickets about the rest.

#7 Updated by Marko Lindqvist 5 months ago

Marko Lindqvist wrote:

Will open new tickets about the rest.

-> https://osdn.net/projects/freeciv/ticket/42052

#8 Updated by Marko Lindqvist 5 months 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 5 months ago

- Calculate more sensible max number of attempts before bailing out

#10 Updated by Marko Lindqvist 5 months ago

  • Status changed from Resolved to Closed
  • Assignee set to Marko Lindqvist

Also available in: Atom PDF