bergerhealer/TrainCarts

Trains were abnormal when server shutdown unusually or crashed.

Closed this issue · 1 comments

Info

Please provide the following information:

  • BkCommonLib Version (/train version): build 1438
  • TrainCarts Version (/train version): build 1278
  • Server Type and Version (/version): paper-370

Bug

Description

If the server quits abnormally, the train will probably have the following problems:

  1. trains disconnection,
  2. trains reverse,
  3. trains disappear (in /train list or in Minecraft world)

This does not happen on all trains, but mainly on trains with speeds higher than 0.4.

Expected behaviour

The plugin should save the train state at regular intervals and load it when the server starts to ensure that the plugin can counteract abnormal server exits.

Actual behaviour

As description.

Steps to reproduce

  1. Create a railway, make sure the railroad is long enough for the train to leave the chunks loaded by the player.
  2. Create a train with maxspeed 5 that will force chunks to be loaded.
  3. Lauch the train.
  4. When the train is moving, kill the server process.
  5. Start the server, the train will disappear.

Additional Information

My players and I have enjoyed this plugin so much that I created a server where railroads are the primary mode of transportation and players use high speed railroads instead of neither ice paths, so there are a large number of railroads in the server, each running multiple trains with different functions.

Server crashes are unavoidable under any circumstances, and after several recent crashes players have been devastated by the need to rearrange their complex train systems. I am therefore very anxious for the plugin to counteract data anomalies caused by abnormal server shutdowns, for example by storing the status of running trains at regular intervals and loading them when the server starts.

I think this is a very necessary feature for applying this plugin to large servers built with rail as the main mode of transportation.

TrainCarts does have logic to try to mitigate this. However, a crash can cause the trains that TC knows and the real entities in the world to desync, which then TC isn't able to fix the situation. It is never guaranteed that TC can recover trains from a crash, and this will never be the case.
If server crashes are unavoidable in your situation, then you should either fix that, or only spawn trains when needed instead of keeping them running at all times.