Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emergency netsave on server restart connection failure saves title game #8887

Open
James103 opened this issue Mar 24, 2021 · 1 comment
Open
Labels
bug Something isn't working priority: low This issue should be fixed but has either a low impact or is en edge-case

Comments

@James103
Copy link
Contributor

James103 commented Mar 24, 2021

Version of OpenTTD

Tested on f9d24ff

Expected result

When the server crashes right after loading a savegame and the client (that is reconnecting at the time) gets disconnected, autosave/netsave.sav contains a copy of the old network game before the server restarted.

Actual result

When the server crashes right after loading a savegame and the client (that is reconnecting at the time) gets disconnected, autosave/netsave.sav contains a copy of the title screen game.

By contrast, when the server crashes while loading a savegame, the client is disconnected and autosave/netsave.sav contains a copy of the old network game before the server restarted.

Steps to reproduce

  1. Start a server (openttd -D ::1).
  2. Start the client (openttd).
  3. Client: Connect to the server (connect ::1).
  4. Server: Load a savegame that causes the server to crash while the client is reconnecting. For example, the crash.sav from Crash during vehicle unload #5995.
  5. The server restarts as it prepares to load the save, causing the client to save the current game state to autosave/netsave.sav and exit to the title screen (which replaces the game state with that of the title game).
  6. When the error window pops up, click the "OK" button as fast as you can.
  7. The server will close while the client is downloading the map, causing the client to save the current game state again (title game this time) to autosave/netsave.sav.

Alternative steps to reproduce

  1. Set map_x and map_y in openttd.cfg to at least 11.
  2. Start the server.
  3. Start the client.
  4. Client: Connect to the server.
  5. Server: Generate a new map using restart or newmap.
  6. The server restarts as it prepares to generate a new map, causing the client to save the current game state to autosave/netsave.sav and exit to the title screen (which replaces the game state with that of the title game).
  7. While the client is downloading the map, close the server.
  8. The client is disconnected while download the map, causing the client to save the title game to autosave/netsave.sav.
@TrueBrain
Copy link
Member

Unless I am missing something, this doesn't seem to hurt anyone. As in, sure, the netsave is a bit weird, but other than that, no harm done.

The client does this as he currently has the titlescreen loaded, and no code is saying: don't make a netsave if you have the titlegame loaded. Possibly a simple fix .. possibly a complex fix .. strongly depends on the information available :D Haven't checked that out.

@TrueBrain TrueBrain added bug Something isn't working priority: low This issue should be fixed but has either a low impact or is en edge-case labels Apr 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working priority: low This issue should be fixed but has either a low impact or is en edge-case
Projects
None yet
Development

No branches or pull requests

2 participants