Help 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 #815196

Can't load game after spaceship victory

Added by George Koehler almost 2 years ago. Updated 6 months ago.

Start date:
Due date:
% Done:


Estimated time:


In freeciv git master 35dabcd, I won by spaceship, then saved the game (in the attached game18-turn404-end.sav.xz). Now I can't load the game because the server gets stuck in an infinite loop. The automatic save (freeciv-T0404-Y01978-final.sav.xz) has the same problem as the attached one.

When I load the save in freeciv-gtk3.22 and click the Start button, I get an infinite stream of chat messages. Most say, "Warning: Famine feared in Eski┼čehir.", but there are also messages about native unrest, sea raiders, and disasters (like fire and flood). The client is stuck on the loading screen (with the list of players) and never enters the actual game. I need to send SIGTERM to freeciv-server.

The save (viewed with xzless) has phase=1 in the [game] section. Most other saves have phase=0. This seems to set = 1 in the code. server/srv_main.c srv_running() has a loop

  while (S_S_RUNNING == server_state()) {
    for (; < game.server.num_phases; {

GDB shows is 1, and game.server.num_phases is also 1, so the inner for loop never runs; but the inner loop seems to contain the logic for talking to clients. The server seems to ignore the clients and have the outer while loop be looping forever. I added a breakpoint at begin_turn, restarted the server, and set = 0 in GDB; this fixed my problem as the actual game appeared in my client.

Guess that Freeciv is missing logic to load saves when == game.server.num_phases

game18-turn404-end.sav.xz (221 KB) game18-turn404-end.sav.xz save after spaceship victory George Koehler, 2019-05-03 01:41 AM
0023-Avoid-infinite-loop-when-phase-from-savegame-num-pha.patch (1.11 KB) 0023-Avoid-infinite-loop-when-phase-from-savegame-num-pha.patch Marko Lindqvist, 2020-10-19 04:33 AM


#1 Updated by Marko Lindqvist over 1 year ago

George Koehler wrote:

Guess that Freeciv is missing logic to load saves when == game.server.num_phases

It sounds like there's a bug in that the save is created with illegal phase number. If num_phases is 1, the only legal phase number is 0.
It wouldn't hurt if the server detected save to be illegal instead of ending to infinite loop, of course.

#2 Updated by Jacob Nevins over 1 year ago

  • Tracker changed from Task to Bug

#3 Updated by Marko Lindqvist 6 months ago

Attached patch makes server to handle such a save. I still don't know how such a save can come to being in the first place.

#4 Updated by Marko Lindqvist 6 months ago

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

Also available in: Atom PDF