Server play unlinks carts when nobody is online
basneder opened this issue ยท 37 comments
Is there an existing issue for this?
- I have searched the existing issues
Description of the Bug
When linking carts on a server, and going offline has a high chance of finding the those carts unlinked.
This is the logging which shows up regularly
[Server thread/WARN] [mods.railcraft.world.entity.vehicle.RollingStockImpl/]: Link mismatch between SteamLocomotive['Steam Locomotive'/338243, l='ServerLevel[world]', x=-104.09, y=115.06, z=-937.50] and MinecartChest['Minecart with Chest'/338244, l='ServerLevel[world]', x=-105.77, y=115.06, z=-937.50] (link was missing on {1})
This issue happens not 100% of the time, but it seems to be fairly persistent
Railcraft Reborn version
1.0.9
NeoForge/Forge version
47.1.76
Minecraft version
1.20.1
Minecraft server
Yes
To Reproduce
- Link multiple carts on normal rails (or cart / steam locomotive )
- Log off from server
- Log on server (hours later)
- Carts are now unlinked
Expected behavior
Carts stay linked when joining the server again.
Logs & Environment
[Server thread/WARN] [mods.railcraft.world.entity.vehicle.RollingStockImpl/]: Link mismatch between SteamLocomotive['Steam Locomotive'/338243, l='ServerLevel[world]', x=-104.09, y=115.06, z=-937.50] and MinecartChest['Minecart with Chest'/338244, l='ServerLevel[world]', x=-105.77, y=115.06, z=-937.50] (link was missing on {1})
Experienced on the pack "FTB Direwolf 1.20 - 1.4.0"
Screenshots & Video
No response
From what I have noticed is that when you connect multiple carts together there is the risk that connections made previously will be removed.
I noticed this when I put the glasses on and set them to "Shunting".
While waiting for a fix, my advice is to check WELL when creating a train.
NOT GOOD:
GOOD:
Try my latest commit: 3cd312e
It looks much better. Try it @basneder
https://github.com/railcraft-reborn/railcraft/actions/runs/8022260933/artifacts/1270345353
@basneder Ok, today I had some time to investigate the problem and it's as you say.
If you connect in the order "locomotive", "chest cart", "tank cart" the connection does not cause problems.
If instead you connect in the order "tank cart", "chest cart", "locomotive", as soon as you exit and re-enter the game you will have the warning spam.
The code you gave seems to solve the problem, before adding it I wanted to ask @Sm0keySa1m0n if it's okay to put it there
@basneder Ok, today I had some time to investigate the problem and it's as you say. If you connect in the order "locomotive", "chest cart", "tank cart" the connection does not cause problems. If instead you connect in the order "tank cart", "chest cart", "locomotive", as soon as you exit and re-enter the game you will have the warning spam. The code you gave seems to solve the problem, before adding it I wanted to ask @Sm0keySa1m0n if it's okay to put it there
I am not sure this would totally solve the problem, later on I found other cases with would not entirely fix it.
Try with the latest version, redo all the connections between the carts and check with your glasses. In theory this bug should no longer occur. If this is not the case, reopen this issue
After some more testing... This seems to happen when parts of tracks/rails are chunkloaded, but not entirely
@basneder Could you confirm whether this issue still occurs?
@basneder Could you confirm whether this issue still occurs?
I cannot confirm this yet, I have no way to deploy this in its current form
(Using the new jar)
Locomotive is still being disconnected from the cart. This results in heaps of logging. SteamLocomotive coordinates change throughout the logging (the locomotive is still running). Cart is standing still
[21:27:24] [Server thread/WARN] [mo.ra.wo.en.ve.RollingStockImpl/]: Link mismatch between SteamLocomotive['Steam Locomotive'/5919, l='ServerLevel[world]', x=-76.50, y=113.06, z=-972.02] and MinecartChest['Minecart with Chest'/5920, l='ServerLevel[world]', x=-153.50, y=115.06, z=-937.50] (link was missing on MinecartChest['Minecart with Chest'/5920, l='ServerLevel[world]', x=-153.50, y=115.06, z=-937.50])
[21:27:24] [Server thread/WARN] [mo.ra.wo.en.ve.RollingStockImpl/]: Link mismatch between SteamLocomotive['Steam Locomotive'/5919, l='ServerLevel[world]', x=-76.50, y=113.06, z=-972.02] and MinecartChest['Minecart with Chest'/5920, l='ServerLevel[world]', x=-153.50, y=115.06, z=-937.50] (link was missing on MinecartChest['Minecart with Chest'/5920, l='ServerLevel[world]', x=-153.50, y=115.06, z=-937.50])
[21:27:24] [Server thread/WARN] [mo.ra.wo.en.ve.RollingStockImpl/]: Link mismatch between SteamLocomotive['Steam Locomotive'/5919, l='ServerLevel[world]', x=-76.50, y=113.06, z=-972.02] and MinecartChest['Minecart with Chest'/5920, l='ServerLevel[world]', x=-153.50, y=115.06, z=-937.50] (link was missing on MinecartChest['Minecart with Chest'/5920, l='ServerLevel[world]', x=-153.50, y=115.06, z=-937.50])
[21:27:24] [Server thread/WARN] [mo.ra.wo.en.ve.RollingStockImpl/]: Link mismatch between SteamLocomotive['Steam Locomotive'/5919, l='ServerLevel[world]', x=-76.50, y=113.06, z=-972.02] and MinecartChest['Minecart with Chest'/5920, l='ServerLevel[world]', x=-153.50, y=115.06, z=-937.50] (link was missing on MinecartChest['Minecart with Chest'/5920, l='ServerLevel[world]', x=-153.50, y=115.06, z=-937.50])
[21:27:24] [Server thread/WARN] [mo.ra.wo.en.ve.RollingStockImpl/]: Link mismatch between SteamLocomotive['Steam Locomotive'/5919, l='ServerLevel[world]', x=-76.50, y=113.06, z=-972.02] and MinecartChest['Minecart with Chest'/5920, l='ServerLevel[world]', x=-153.50, y=115.06, z=-937.50] (link was missing on MinecartChest['Minecart with Chest'/5920, l='ServerLevel[world]', x=-153.50, y=115.06, z=-937.50])
[21:27:24] [Server thread/WARN] [mo.ra.wo.en.ve.RollingStockImpl/]: Link mismatch between SteamLocomotive['Steam Locomotive'/5919, l='ServerLevel[world]', x=-76.50, y=113.06, z=-972.02] and MinecartChest['Minecart with Chest'/5920, l='ServerLevel[world]', x=-153.50, y=115.06, z=-937.50] (link was missing on MinecartChest['Minecart with Chest'/5920, l='ServerLevel[world]', x=-153.50, y=115.06, z=-937.50])
[21:27:24] [Server thread/WARN] [mo.ra.wo.en.ve.RollingStockImpl/]: Link mismatch between SteamLocomotive['Steam Locomotive'/5919, l='ServerLevel[world]', x=-76.50, y=113.06, z=-972.02] and MinecartChest['Minecart with Chest'/5920, l='ServerLevel[world]', x=-153.50, y=115.06, z=-937.50] (link was missing on MinecartChest['Minecart with Chest'/5920, l='ServerLevel[world]', x=-153.50, y=115.06, z=-937.50])
[21:27:24] [Server thread/WARN] [mo.ra.wo.en.ve.RollingStockImpl/]: Link mismatch between SteamLocomotive['Steam Locomotive'/5919, l='ServerLevel[world]', x=-76.50, y=113.00, z=-972.32] and MinecartChest['Minecart with Chest'/5920, l='ServerLevel[world]', x=-153.50, y=115.06, z=-937.50] (link was missing on MinecartChest['Minecart with Chest'/5920, l='ServerLevel[world]', x=-153.50, y=115.06, z=-937.50])
[21:27:24] [Server thread/WARN] [mo.ra.wo.en.ve.RollingStockImpl/]: Link mismatch between SteamLocomotive['Steam Locomotive'/5919, l='ServerLevel[world]', x=-76.50, y=113.00, z=-972.32] and MinecartChest['Minecart with Chest'/5920, l='ServerLevel[world]', x=-153.50, y=115.06, z=-937.50] (link was missing on MinecartChest['Minecart with Chest'/5920, l='ServerLevel[world]', x=-153.50, y=115.06, z=-937.50])
[21:27:24] [Server thread/WARN] [mo.ra.wo.en.ve.RollingStockImpl/]: Link mismatch between SteamLocomotive['Steam Locomotive'/5919, l='ServerLevel[world]', x=-76.50, y=113.00, z=-972.32] and MinecartChest['Minecart with Chest'/5920, l='ServerLevel[world]', x=-153.50, y=115.06, z=-937.50] (link was missing on MinecartChest['Minecart with Chest'/5920, l='ServerLevel[world]', x=-153.50, y=115.06, z=-937.50])
[21:27:24] [Server thread/WARN] [mo.ra.wo.en.ve.RollingStockImpl/]: Link mismatch between SteamLocomotive['Steam Locomotive'/5919, l='ServerLevel[world]', x=-76.50, y=113.06, z=-972.32] and MinecartChest['Minecart with Chest'/5920, l='ServerLevel[world]', x=-153.50, y=115.06, z=-937.50] (link was missing on MinecartChest['Minecart with Chest'/5920, l='ServerLevel[world]', x=-153.50, y=115.06, z=-937.50])
[21:27:24] [Server thread/WARN] [mo.ra.wo.en.ve.RollingStockImpl/]: Link mismatch between SteamLocomotive['Steam Locomotive'/5919, l='ServerLevel[world]', x=-76.50, y=113.06, z=-972.32] and MinecartChest['Minecart with Chest'/5920, l='ServerLevel[world]', x=-153.50, y=115.06, z=-937.50] (link was missing on MinecartChest['Minecart with Chest'/5920, l='ServerLevel[world]', x=-153.50, y=115.06, z=-937.50])
[21:27:24] [Server thread/WARN] [mo.ra.wo.en.ve.RollingStockImpl/]: Link mismatch between SteamLocomotive['Steam Locomotive'/5919, l='ServerLevel[world]', x=-76.50, y=113.06, z=-972.32] and MinecartChest['Minecart with Chest'/5920, l='ServerLevel[world]', x=-153.50, y=115.06, z=-937.50] (link was missing on MinecartChest['Minecart with Chest'/5920, l='ServerLevel[world]', x=-153.50, y=115.06, z=-937.50])
[21:27:24] [Server thread/WARN] [mo.ra.wo.en.ve.RollingStockImpl/]: Link mismatch between SteamLocomotive['Steam Locomotive'/5919, l='ServerLevel[world]', x=-76.50, y=113.06, z=-972.32] and MinecartChest['Minecart with Chest'/5920, l='ServerLevel[world]', x=-153.50, y=115.06, z=-937.50] (link was missing on MinecartChest['Minecart with Chest'/5920, l='ServerLevel[world]', x=-153.50, y=115.06, z=-937.50])
[21:27:24] [Server thread/WARN] [mo.ra.wo.en.ve.RollingStockImpl/]: Link mismatch between SteamLocomotive['Steam Locomotive'/5919, l='ServerLevel[world]', x=-76.50, y=113.06, z=-972.32] and MinecartChest['Minecart with Chest'/5920, l='ServerLevel[world]', x=-153.50, y=115.06, z=-937.50] (link was missing on MinecartChest['Minecart with Chest'/5920, l='ServerLevel[world]', x=-153.50, y=115.06, z=-937.50])
I was finally able to get the world download from the server and run it in a different instance. I installed the jar file in both client and server.
Sadly it doesn't fix the issue. The locomotive still gets disconnected. (But no logging in the server console)
As another hint maybe? The locomotive sometimes also has much difficulty to start running again once it has stopped.
And now also logging appears in server log.
[19:42:10] [Server thread/WARN] [mo.ra.wo.en.ve.RollingStockImpl/]: Link mismatch between {0} and {1} (link was missing on {1})
[19:42:10] [Server thread/WARN] [mo.ra.wo.en.ve.RollingStockImpl/]: Link mismatch between {0} and {1} (link was missing on {1})
[19:42:10] [Server thread/WARN] [mo.ra.wo.en.ve.RollingStockImpl/]: Link mismatch between {0} and {1} (link was missing on {1})
[19:42:10] [Server thread/WARN] [mo.ra.wo.en.ve.RollingStockImpl/]: Link mismatch between {0} and {1} (link was missing on {1})
[19:42:10] [Server thread/WARN] [mo.ra.wo.en.ve.RollingStockImpl/]: Link mismatch between {0} and {1} (link was missing on {1})
This is now flooding the server log, many messages a second
I've tested the latest build of the mod with your test world in Direwolf20 1.20 - 1.9.1 but I can't seem to re-create the issue. Are you 100% sure that your server is using the latest build of the mod?
I've tested the latest build of the mod with your test world in Direwolf20 1.20 - 1.9.1 but I can't seem to re-create the issue. Are you 100% sure that your server is using the latest build of the mod?
Yes I am sure it uses the latest version (there are no manual changes to the pack)
Too bad you cannot reproduce this issue. With the test world I created, I was able to trigger the issue very quick. Letting the train run. logging out from the server. And after a minute or 10 later logging back in, the carts were disconnected from the locomotive.
I will see if I can find a solid case where/when it happens all the time.
Yes I am sure it uses the latest version (there are no manual changes to the pack)
You'll need to manually add the latest version of the mod to the pack as it's not on CurseForge.
Yes I am sure it uses the latest version (there are no manual changes to the pack)
You'll need to manually add the latest version of the mod to the pack as it's not on CurseForge.
Ah yes, my bad. I did test the JAR you send me with the big world/server. But on the test-server I recreated the problem with the original JAR file.
I will redo and test, and come back
Updated the JAR, and did the test again. I removed all carts and locomotives, and put in new ones on the track.
This is the jar, I use for the server and client (from 6 dec 19:39), with its md5 sum.
40066ecc1a3a973c89e55ebe21884e60 railcraft-reborn-1.20.1-1.0.9.jar
I also included now the "logs/" directory which shows the console logging, in which state the server was left before stopping it. In the current world, the carts are already disconnected.
Could you send the world over and I'll debug on my end? Also is this just on the server or also in single player?
http://81.169.250.240/assets/world-railcraft.tar.xz
(test course is at -7, 64, -16). I had to change world spawn so not to have the course chunkloaded maybe because of spawn rules
I've put a small test world here, which has the same issues. This world uses the FTB Pack 'Direwolf20 1.20 - 1.9.1'.
After going offline for a few minutes and logging back in, the carts have detached and logging appears on the server console
Could you also include the mods folder so I can be certain we're testing with exactly the same mods?
Could you also include the mods folder so I can be certain we're testing with exactly the same mods?
Added the mods/ directory in a separate file
Hi @basneder, I fixed a possible bug, I'm not sure but it might solve your problem. Could you try this jar?
https://github.com/railcraft-reborn/railcraft/actions/runs/7423897818/artifacts/1150293368
So far it is looking good (no issues, including 2 server restarts), will keep the server running with the new jar for a while longer though, just to be sure
@Edivad99 Just had another look at the server, the trains are still going, this issue seems to be fixed, thanks!
If this can be released soon so it can go into the next version of the direwolf20 pack, I would be very happy
How is the situation going? Has the bug recurred? I plan to release the new version on Monday evening.
The server has been running the entire weekend and I have not seen the bug anymore.
How is the situation going? Has the bug recurred?
I plan to release the new version on Monday evening.
After upgrading the "FTB Direwolf20 1.20" pack to the latest version (1.12.0), which contains the upgrade Rail Craft Reborn, the problem is back unfortunately. Because of the update, there is now so much logging (dozens per second)
E.g.
[13:59:33] [Server thread/WARN] [mo.ra.wo.en.ve.RollingStockImpl/]: Link mismatch between SteamLocomotive['Steam Locomotive'/97468, l='ServerLevel[world]', x=-145.72, y=115.06, z=-941.50] and MinecartChest['Minecart with Chest'/97465, l='ServerLevel[world]', x=-149.15, y=115.06, z=-941.50] (link was missing on MinecartChest['Minecart with Chest'/97465, l='ServerLevel[world]', x=-149.15, y=115.06, z=-941.50])
[13:59:33] [Server thread/WARN] [mo.ra.wo.en.ve.RollingStockImpl/]: Link mismatch between SteamLocomotive['Steam Locomotive'/97468, l='ServerLevel[world]', x=-145.72, y=115.06, z=-941.50] and MinecartChest['Minecart with Chest'/97465, l='ServerLevel[world]', x=-149.15, y=115.06, z=-941.50] (link was missing on MinecartChest['Minecart with Chest'/97465, l='ServerLevel[world]', x=-149.15, y=115.06, z=-941.50])
[13:59:33] [Server thread/WARN] [mo.ra.wo.en.ve.RollingStockImpl/]: Link mismatch between SteamLocomotive['Steam Locomotive'/97468, l='ServerLevel[world]', x=-145.72, y=115.06, z=-941.50] and MinecartChest['Minecart with Chest'/97465, l='ServerLevel[world]', x=-149.15, y=115.06, z=-941.50] (link was missing on MinecartChest['Minecart with Chest'/97465, l='ServerLevel[world]', x=-149.15, y=115.06, z=-941.50])
[13:59:33] [Server thread/WARN] [mo.ra.wo.en.ve.RollingStockImpl/]: Link mismatch between SteamLocomotive['Steam Locomotive'/97468, l='ServerLevel[world]', x=-145.72, y=115.06, z=-941.50] and MinecartChest['Minecart with Chest'/97465, l='ServerLevel[world]', x=-149.15, y=115.06, z=-941.50] (link was missing on MinecartChest['Minecart with Chest'/97465, l='ServerLevel[world]', x=-149.15, y=115.06, z=-941.50])
[13:59:33] [Server thread/WARN] [mo.ra.wo.en.ve.RollingStockImpl/]: Link mismatch between SteamLocomotive['Steam Locomotive'/97468, l='ServerLevel[world]', x=-145.72, y=115.06, z=-941.50] and MinecartChest['Minecart with Chest'/97465, l='ServerLevel[world]', x=-149.15, y=115.06, z=-941.50] (link was missing on MinecartChest['Minecart with Chest'/97465, l='ServerLevel[world]', x=-149.15, y=115.06, z=-941.50])
[13:59:33] [Server thread/WARN] [mo.ra.wo.en.ve.RollingStockImpl/]: Link mismatch between SteamLocomotive['Steam Locomotive'/97468, l='ServerLevel[world]', x=-145.72, y=115.06, z=-941.50] and MinecartChest['Minecart with Chest'/97465, l='ServerLevel[world]', x=-149.15, y=115.06, z=-941.50] (link was missing on MinecartChest['Minecart with Chest'/97465, l='ServerLevel[world]', x=-149.15, y=115.06, z=-941.50])
[13:59:33] [Server thread/WARN] [mo.ra.wo.en.ve.RollingStockImpl/]: Link mismatch between SteamLocomotive['Steam Locomotive'/97468, l='ServerLevel[world]', x=-145.72, y=115.06, z=-941.50] and MinecartChest['Minecart with Chest'/97465, l='ServerLevel[world]', x=-149.15, y=115.06, z=-941.50] (link was missing on MinecartChest['Minecart with Chest'/97465, l='ServerLevel[world]', x=-149.15, y=115.06, z=-941.50])
[13:59:33] [Server thread/WARN] [mo.ra.wo.en.ve.RollingStockImpl/]: Link mismatch between SteamLocomotive['Steam Locomotive'/97468, l='ServerLevel[world]', x=-145.72, y=115.06, z=-941.50] and MinecartChest['Minecart with Chest'/97465, l='ServerLevel[world]', x=-149.15, y=115.06, z=-941.50] (link was missing on MinecartChest['Minecart with Chest'/97465, l='ServerLevel[world]', x=-149.15, y=115.06, z=-941.50])
[13:59:33] [Server thread/WARN] [mo.ra.wo.en.ve.RollingStockImpl/]: Link mismatch between SteamLocomotive['Steam Locomotive'/97468, l='ServerLevel[world]', x=-145.72, y=115.06, z=-941.50] and MinecartChest['Minecart with Chest'/97465, l='ServerLevel[world]', x=-149.15, y=115.06, z=-941.50] (link was missing on MinecartChest['Minecart with Chest'/97465, l='ServerLevel[world]', x=-149.15, y=115.06, z=-941.50])
Try removing and re-adding all carts/locomotives
This did not help unfortunately. I trashed all the blocks/items, and made a new train out of steam locomotive and a few new chest carts. After logging out and logging in, the issue appears right away --> Train is connected from carts and the logging appears in the console.
In the test world used before, (with the track that had the same problems in the past) I was not able to reproduce the issue.
Both were using the same mods/ directory (containing "railcraft-reborn-1.20.1-1.0.10.jar")
The following update seems to work for me in src/main/java/mods/railcraft/world/entity/vehicle/RollingStockImpl.java line 285
Or this is a complete random happening, but now I am unable to get the WARN logging back in the server console. I can do longer testing, just wanted to let you know where to look maybe.
Not the prettiest fix, but I think in the original version setting it 'false' would return before setting the actual value to false.
@Override
public boolean setAutoLinkEnabled(Side side, boolean enabled) {
if (enabled && this.disabledSide().filter(side::equals).isPresent()) {
switch (side) {
case BACK -> this.backAutoLinkEnabled = enabled;
case FRONT -> this.frontAutoLinkEnabled = enabled;
}
return false;
}
switch (side) {
case BACK -> this.backAutoLinkEnabled = enabled;
case FRONT -> this.frontAutoLinkEnabled = enabled;
}
return true;
}
With change from the previous comment I am not able to trigger/reproduce the problem anymore. It has been running now for 20 hours. Logged in on and off during this period.
Looking at the code change again, I am not sure why it works, the reasoning I did yesterday seems to not make complete sense.
I will do some more testing
How is the situation going? Has the bug recurred? I plan to release the new version on Monday evening.
The server has been running the entire weekend and I have not seen the bug anymore.
It seemed like it was working here too, but apparently it isn't. We need to investigate better...
I think I found the root cause at last.
The problem seems to happen when I link carts from 'back to forth' and having multiple chest carts in the total train, instead of starting at the front.
How I usually work is, placing "locomotive", "chest cart", "chest cart", "chest cart". And since I am at the back of the line, I link them in reverse order. "chest cart" ,"chest cart", "chest cart", "locomotive".
This also explains why the problem seems to vanish at times, its was when I created the train 'the correct way'.
I think I found the root cause at last. The problem seems to happen when I link carts from 'back to forth' and having multiple chest carts in the total train, instead of starting at the front.
How I usually work is, placing "locomotive", "chest cart", "chest cart", "chest cart". And since I am at the back of the line, I link them in reverse order. "chest cart" ,"chest cart", "chest cart", "locomotive".
This also explains why the problem seems to vanish at times, its was when I created the train 'the correct way'.
@Sm0keySa1m0n Could this be the reason?