Menu

#304 use of server admin commands

None
closed-fixed
nobody
None
5
2021-05-14
2020-05-11
jdv
No

Hello Pioneers devs,

Using Pioneers v.15.5.

I have been testing out Pioneers as an alternative to the Catan Universe game, which seems to suffer from some significant bugs itself. Pioneers seems to work well in general, and now I would like to be able to use the admin/port commands documented in the manual to control the server. However, there seem to be some issues with this functionality. Below is a report of what I have found and a possible fix.

First, start an instance of pioneers-server-console in wait mode:

jeremy@localhost:~$ pioneers-server-console --port 1234 --admin-port 2345 --admin-wait
12:55:47 - Looking for games in '/home/jeremy/.local/share/pioneers'
12:55:47 - Game directory '/home/jeremy/.local/share/pioneers' not found
12:55:47 - Looking for games in '/usr/share/games/pioneers'

Next, connect to the server admin port:

jeremy@localhost:~$ netcat localhost 2345
welcome to the pioneers admin connection, version 15.5

So far everything looks okay, as far as I can tell. Now,

admin set-game Default
ERROR game 'Default' not set

I am unable to set the game/scenario to use. This is an issue since, even if the game is specified when the server is started, no other parameters can be set until the game is set. For instance,

admin set-num-players 3
ERROR command 'set-num-players' needs valid game parameters

So the params object is not created until the game is set. It is possible to start the server without the --admin-wait parameter, and then stop the game via the admin interface:

admin stop-server
INFO server stopped
admin set-game Default

but this causes a segfault in the server. I believe I know the reason for this (trying to load the game list multiple times) but I will document this in a separate bug report.

After wading through server/server.c, server/admin.c, and common/game-list.c, I believe the issue arises because the console server cleans up the game list after loading it each time. From server.c:

337 GameParams *cfg_set_game(const gchar * game)
338 {
339 #ifdef PRINT_INFO
340     g_print("cfg_set_game: %s\n", game);
341 #endif
342     if (game_list_is_empty()) {
343         game_list_prepare();
344         GameParams *param = params_copy(game_list_find_item(game));
345         game_list_cleanup();
346         return param;
347     } else {
348         return params_copy(game_list_find_item(game));
349     }
350 }

So, game_list_cleanup() is being called right after the game list is loaded the first time. Later, when the server checks if the game list is loaded, it seems to think it is even though the list has been cleared. There is probably some logic here that needs to be fixed, too, but I haven't traced it. In the GTK version of the server, game_list_cleanup() is only called during the cleanup process as the server is being shut down.

The problem seems to be fixed by removing the game_list_cleanup() from the above function and moving it to server/main.c. After this, I am able to set the game name and other parameters as expected and start and stop games through the admin interface. A patch is attached.

1 Attachments

Discussion

  • Roland Clobus

    Roland Clobus - 2020-07-26
    • status: open --> open-fixed
    • Group: -->
     
  • Roland Clobus

    Roland Clobus - 2020-07-26

    Hello jdv,

    Thanks for your excellent bug report.
    When reproducing the issue, I had different behaviour on:

    admin set-game Default
    ERROR game 'Default' not set
    

    I got a SEGFAULT instead of an error message. It turns out that the pointer wasn't reset after clearing the list of games.
    This is now fixed, and pending the new release.

    With kind regards,
    Roland Clobus

     
  • Roland Clobus

    Roland Clobus - 2021-05-14
    • status: open-fixed --> closed-fixed
     
  • Roland Clobus

    Roland Clobus - 2021-05-14

    Pioneers 15.6 was released 2020-08-02

     

Log in to post a comment.

MongoDB Logo MongoDB