ptitSeb / box64

Box64 - Linux Userspace x86_64 Emulator with a twist, targeted at ARM64 Linux devices
https://box86.org
MIT License
3.43k stars 245 forks source link

Factorio clients desync #211

Closed nicball closed 1 week ago

nicball commented 2 years ago

I am running a factorio headless server on a raspberry pi 4. The program starts up fine, but clients always get desyncs a few seconds after joining in.

I have tried turning on non_blocking_saving in server-settings.json. Nothing's changed.

I have also tried running it with qemu-user. It runs correctly, but with 1/10 of the native performance it's unplayable.

Here's factorio's log:

pi@sahib-raspi ~/t/factorio> factorio --start-server ./saves/sandbox.zip --server-settings server-settings.json -c ~/.config/factorio/config.cfg Dynarec for ARM64, with extension: ASIMD CRC32 PageSize:4096 Box64 with Dynarec v0.1.7 9bf7185 built on Jan 14 2022 22:22:16 Using default BOX64_LD_LIBRARY_PATH: ./:lib/:lib64/:x86_64/:bin64/:libs64/ Using default BOX64_PATH: ./:bin/ Counted 24 Env var Looking for /home/pi/.nix-profile/bin/factorio argv[1]="--start-server" argv[2]="./saves/sandbox.zip" argv[3]="--server-settings" argv[4]="server-settings.json" argv[5]="-c" argv[6]="/home/pi/.config/factorio/config.cfg" Using native(wrapped) librt.so.1 Using native(wrapped) libdl.so.2 Using native(wrapped) libm.so.6 Using native(wrapped) libpthread.so.0 Using native(wrapped) libc.so.6 Using native(wrapped) ld-linux-x86-64.so.2 0.002 2022-01-15 13:44:03; Factorio 1.1.50 (build 59278, linux64, headless) 0.117 Operating system: Linux (Debian 10) 0.118 Program arguments: "/home/pi/.nix-profile/bin/factorio" "--start-server" "./saves/sandbox.zip" "--server-settings" "server-settings.json" "-c" "/home/pi/.config/factorio/config.cfg" 0.119 Read data path: /nix/store/bpl7pzx61bp6lmi5qdbhvszvf99n7rjq-factorio-headless-1.1.50/share/factorio/data 0.119 Write data path: /home/pi/.factorio [417360/939311MB] 0.119 Binaries path: /nix/store/bpl7pzx61bp6lmi5qdbhvszvf99n7rjq-factorio-headless-1.1.50 0.173 System info: [CPU: Intel(R) Pentium(R) 4 CPU 1000MHz, 4 cores, RAM: 3794 MB] 0.174 Environment: DISPLAY= WAYLAND_DISPLAY= DESKTOP_SESSION= XDG_SESSION_DESKTOP= XDG_CURRENT_DESKTOP= GL_FSAA_MODE= GL_LOG_MAX_ANISO= __GL_SYNC_TO_VBLANK= GL_SORT_FBCONFIGS= GL_YIELD= 0.175 Running in headless mode 0.450 Loading mod core 0.0.0 (data.lua) 0.756 Loading mod base 1.1.50 (data.lua) 2.400 Loading mod base 1.1.50 (data-updates.lua) 2.984 Checksum for core: 1625176034 2.984 Checksum of base: 321760681 4.659 Prototype list checksum: 3034860339 4.862 Info PlayerData.cpp:71: Local player-data.json available, timestamp 1642225413 4.863 Info PlayerData.cpp:78: Cloud player-data.json unavailable 4.893 Info GlobalContext.cpp:1301: Resetting config. 4.913 Factorio initialised 4.924 Info ServerSynchronizer.cpp:29: nextHeartbeatSequenceNumber(0) initialized Synchronizer nextTickClosureTick(0). 4.925 Info ServerMultiplayerManager.cpp:797: updateTick(4294967295) changing state from(Ready) to(PreparedToHostGame) 4.925 Info ServerMultiplayerManager.cpp:797: updateTick(4294967295) changing state from(PreparedToHostGame) to(CreatingGame) 4.928 Loading map /home/pi/tmp/factorio/./saves/sandbox.zip: 1176503 bytes. 5.030 Loading level.dat: 2136748 bytes. 5.594 Info Scenario.cpp:198: Map version 1.1.50-1 6.527 Loading script.dat: 95 bytes. 6.555 Checksum for script /home/pi/.factorio/temp/currently-playing/control.lua: 2183368195 6.587 Info UDPSocket.cpp:27: Opening socket at (IP ADDR:({0.0.0.0:34197})) 6.589 Hosting game at IP ADDR:({0.0.0.0:34197}) 6.592 Info HttpSharedState.cpp:54: Downloading https://auth.factorio.com/generate-server-padlock-2?api_version=4 7.525 Info AuthServerConnector.cpp:68: Obtained serverPadlock for serverHash (q5P8hDKgNeOClOcUzXenXBGMymFCzIHK) from the auth server. 7.525 Info ServerMultiplayerManager.cpp:797: updateTick(3819) changing state from(CreatingGame) to(InGame) 7.527 Info UDPSocket.cpp:39: Opening socket for broadcast 7.534 Info CommandLineMultiplayer.cpp:284: Maximum segment size = 100; minimum segment size = 25; maximum-segment-size peer count = 10; minimum-segment-size peer count = 20 62.475 ConnectionRequestReplyConfirm (type(ConnectionRequestReplyConfirm) ) from(IP ADDR:({192.168.0.11:58958})) 62.479 Refusing connection for address (IP ADDR:({192.168.0.11:58958})), username (nicball). UserVerificationMissing 63.656 ConnectionRequestReplyConfirm (type(ConnectionRequestReplyConfirm) ) from(IP ADDR:({192.168.0.11:58959})) 63.663 Info ServerRouter.cpp:467: Replying to connectionRequest for address(IP ADDR:({192.168.0.11:58959})). 63.669 Info ServerSynchronizer.cpp:607: nextHeartbeatSequenceNumber(3366) adding peer(1) 63.711 Info ServerMultiplayerManager.cpp:797: updateTick(3819) changing state from(InGame) to(InGameSavingMap) 63.722 Info ServerMultiplayerManager.cpp:946: updateTick(3819) received stateChanged peerID(1) oldState(Ready) newState(ConnectedWaitingForMap) 66.762 Info ServerMultiplayerManager.cpp:1013: UpdateTick(3819) Serving map(/home/pi/.factorio/temp/mp-save-0.zip) for peer(1) size(1176727) crc(4045038720) 66.764 Info ServerMultiplayerManager.cpp:797: updateTick(3819) changing state from(InGameSavingMap) to(InGame) 66.839 Info ServerMultiplayerManager.cpp:946: updateTick(3819) received stateChanged peerID(1) oldState(ConnectedWaitingForMap) newState(ConnectedDownloadingMap) 67.322 Info ServerMultiplayerManager.cpp:946: updateTick(3819) received stateChanged peerID(1) oldState(ConnectedDownloadingMap) newState(ConnectedLoadingMap) 67.526 Info ServerMultiplayerManager.cpp:946: updateTick(3828) received stateChanged peerID(1) oldState(ConnectedLoadingMap) newState(TryingToCatchUp) 67.528 Info ServerMultiplayerManager.cpp:946: updateTick(3828) received stateChanged peerID(1) oldState(TryingToCatchUp) newState(WaitingForCommandToStartSendingTickClosures) 67.532 Info GameActionHandler.cpp:4994: UpdateTick (3828) processed PlayerJoinGame peerID(1) playerIndex(0) mode(connect) 67.589 Info ServerMultiplayerManager.cpp:946: updateTick(3834) received stateChanged peerID(1) oldState(WaitingForCommandToStartSendingTickClosures) newState(InGame) 2022-01-15 13:45:11 [JOIN] nicball joined the game 72.472 Info ServerMultiplayerManager.cpp:946: updateTick(3997) received stateChanged peerID(1) oldState(InGame) newState(DesyncedWaitingForMap) 72.473 Info ServerMultiplayerManager.cpp:1035: updateTick(3997) received playerDesynced peer (1) 72.478 Info ServerMultiplayerManager.cpp:797: updateTick(3997) changing state from(InGame) to(InGameSavingMapForDesyncReport) 90.800 Info ServerMultiplayerManager.cpp:1013: UpdateTick(3997) Serving map(/home/pi/.factorio/temp/mp-save-1.zip) for peer(1) size(3380484) crc(1838171653) 90.801 Info ServerMultiplayerManager.cpp:797: updateTick(3997) changing state from(InGameSavingMapForDesyncReport) to(InGame) 90.889 Info ServerMultiplayerManager.cpp:946: updateTick(3997) received stateChanged peerID(1) oldState(DesyncedWaitingForMap) newState(DesyncedCatchingUpWithMapReadyForDownload) 90.889 Info ServerMultiplayerManager.cpp:946: updateTick(3997) received stateChanged peerID(1) oldState(DesyncedCatchingUpWithMapReadyForDownload) newState(DesyncedSavingLocalVariantOfMap) 91.273 Info ServerMultiplayerManager.cpp:946: updateTick(3997) received stateChanged peerID(1) oldState(DesyncedSavingLocalVariantOfMap) newState(DesyncedDownloadingMap) 92.339 Info ServerMultiplayerManager.cpp:946: updateTick(3997) received stateChanged peerID(1) oldState(DesyncedDownloadingMap) newState(DesyncedCreatingReport) 92.689 Info ServerMultiplayerManager.cpp:1064: Disconnect notification for peer (1) 92.690 Info ServerMultiplayerManager.cpp:946: updateTick(4017) received stateChanged peerID(1) oldState(DesyncedCreatingReport) newState(DisconnectScheduled) 2022-01-15 13:45:36 [LEAVE] nicball left the game 92.691 Warning ServerSynchronizer.cpp:125: nextHeartbeatSequenceNumber(4948) address(IP ADDR:({192.168.0.11:58959})) wants a heartbeat(4948) that we don't have. 92.693 Info ServerSynchronizer.cpp:626: nextHeartbeatSequenceNumber(4949) removing peer(1). 92.706 Warning ServerSynchronizer.cpp:125: nextHeartbeatSequenceNumber(4949) address(IP ADDR:({192.168.0.11:58959})) wants a heartbeat(4949) that we don't have.

Also, owner of this issue has run factorio server successfully. May I ask for your @shyguy80 suggestion? (I don't know how to quote)

orlea commented 2 years ago

I have the same problem in my environment. I have enabled non-blocking-saving, but there was no change. Is there anyone who is working well?

Environment

logs

% box64 ./bin/x64/factorio --start-server-load-latest --server-settings data/server-settings.json
Dynarec for ARM64, with extension: ASIMD AES CRC32 PMULL ATOMICS PageSize:4096
Box64 with Dynarec v0.1.7 ca3247d built on Jan 24 2022 15:50:25
Using default BOX64_LD_LIBRARY_PATH: ./:lib/:lib64/:x86_64/:bin64/:libs64/
Using default BOX64_PATH: ./:bin/
Counted 28 Env var
Looking for ./bin/x64/factorio
argv[1]="--start-server-load-latest"
argv[2]="--server-settings"
argv[3]="data/server-settings.json"
Using native(wrapped) librt.so.1
Using native(wrapped) libdl.so.2
Using native(wrapped) libm.so.6
Using native(wrapped) libpthread.so.0
Using native(wrapped) libc.so.6
Using native(wrapped) ld-linux-x86-64.so.2
   0.001 2022-01-24 16:21:38; Factorio 1.1.53 (build 59373, linux64, headless)
   0.039 Operating system: Linux (Ubuntu 20.04)
   0.040 Program arguments: "/home/aries/factorio/bin/x64/factorio" "--start-server-load-latest" "--server-settings" "data/server-settings.json"
   0.040 Read data path: /home/aries/factorio/data
   0.040 Write data path: /home/aries/factorio [32458/46053MB]
   0.040 Binaries path: /home/aries/factorio/bin
   0.066 System info: [CPU:               Intel(R) Pentium(R) 4 CPU 1000MHz, 4 cores, RAM: 23872 MB]
   0.067 Environment: DISPLAY=<unset> WAYLAND_DISPLAY=<unset> DESKTOP_SESSION=<unset> XDG_SESSION_DESKTOP=<unset> XDG_CURRENT_DESKTOP=<unset> __GL_FSAA_MODE=<unset> __GL_LOG_MAX_ANISO=<unset> __GL_SYNC_TO_VBLANK=<unset> __GL_SORT_FBCONFIGS=<unset> __GL_YIELD=<unset>
   0.067 Running in headless mode
   0.172 Loading mod core 0.0.0 (data.lua)
   0.279 Loading mod base 1.1.53 (data.lua)
   0.846 Loading mod base 1.1.53 (data-updates.lua)
   1.087 Checksum for core: 1625176034
   1.087 Checksum of base: 98178652
   1.813 Prototype list checksum: 3034860339
   1.889 Info PlayerData.cpp:71: Local player-data.json available, timestamp 1643008802
   1.889 Info PlayerData.cpp:78: Cloud player-data.json unavailable
   1.919 Factorio initialised
   1.923 Info ServerSynchronizer.cpp:29: nextHeartbeatSequenceNumber(0) initialized Synchronizer nextTickClosureTick(0).
   1.924 Info ServerMultiplayerManager.cpp:797: updateTick(4294967295) changing state from(Ready) to(PreparedToHostGame)
   1.924 Info ServerMultiplayerManager.cpp:797: updateTick(4294967295) changing state from(PreparedToHostGame) to(CreatingGame)
   1.925 Loading map /home/aries/factorio/saves/world.zip: 728127 bytes.
   1.959 Loading level.dat: 1711088 bytes.
   2.145 Info Scenario.cpp:198: Map version 1.1.53-0
   2.374 Loading script.dat: 1182 bytes.
   2.385 Checksum for script /home/aries/factorio/temp/currently-playing/control.lua: 3795083680
   2.400 Info UDPSocket.cpp:27: Opening socket at (IP ADDR:({0.0.0.0:34197}))
   2.401 Hosting game at IP ADDR:({0.0.0.0:34197})
   2.403 Info HttpSharedState.cpp:54: Downloading https://auth.factorio.com/generate-server-padlock-2?api_version=4
   3.048 Info AuthServerConnector.cpp:68: Obtained serverPadlock for serverHash (9QtNqdagT1PtF34RyZsg2VVBK94c9fA7) from the auth server.
   3.049 Info ServerMultiplayerManager.cpp:797: updateTick(10766) changing state from(CreatingGame) to(InGame)
   3.081 Info ServerRouter.cpp:657: Asking pingpong servers (pingpong1.factorio.com:34197, pingpong2.factorio.com:34197, pingpong3.factorio.com:34197, pingpong4.factorio.com:34197) for own address
   3.082 Info UDPSocket.cpp:39: Opening socket for broadcast
   3.086 Info CommandLineMultiplayer.cpp:293: Maximum segment size = 100; minimum segment size = 25; maximum-segment-size peer count = 10; minimum-segment-size peer count = 20
   3.256 Info ServerRouter.cpp:540: Own address is IP ADDR:({140.83.82.187:34197}) (confirmed by pingpong1)
   3.256 Info ServerRouter.cpp:540: Own address is IP ADDR:({140.83.82.187:34197}) (confirmed by pingpong3)
   3.272 Error ServerMultiplayerManager.cpp:734: Matching server connection failed: Error when creating server game: Missing token.
   3.339 Info ServerRouter.cpp:540: Own address is IP ADDR:({140.83.82.187:34197}) (confirmed by pingpong2)
  11.073 ConnectionRequestReplyConfirm (type(ConnectionRequestReplyConfirm) ) from(IP ADDR:({153.169.24.224:64983}))
  11.076 Info ServerRouter.cpp:623: Generated hmac(0VU5NKjkvIGONFMLHqAKpw==) and serverKey(SYwdXrw282EsFF71XEyriw==) for username(orlea) differ. Generated from message(orlea_ojKTln0VUMDyYqPci5odzPDKTWg7M/ktTGZldNJjy9g=_220124071346).
  11.078 Refusing connection for address (IP ADDR:({153.169.24.224:64983})), username (orlea). UserVerificationMismatch
  11.922 ConnectionRequestReplyConfirm (type(ConnectionRequestReplyConfirm) ) from(IP ADDR:({153.169.24.224:49451}))
  11.923 Info ServerRouter.cpp:467: Replying to connectionRequest for address(IP ADDR:({153.169.24.224:49451})).
  11.924 Info ServerSynchronizer.cpp:608: nextHeartbeatSequenceNumber(529) adding peer(1)
  11.951 Info ServerMultiplayerManager.cpp:797: updateTick(10766) changing state from(InGame) to(InGameSavingMap)
  11.960 Info ServerMultiplayerManager.cpp:946: updateTick(10766) received stateChanged peerID(1) oldState(Ready) newState(ConnectedWaitingForMap)
  12.725 Info ServerMultiplayerManager.cpp:1013: UpdateTick(10766) Serving map(/home/aries/factorio/temp/mp-save-0.zip) for peer(1) size(728559) crc(1764063683)
  12.727 Info ServerMultiplayerManager.cpp:797: updateTick(10766) changing state from(InGameSavingMap) to(InGame)
  12.789 Info ServerMultiplayerManager.cpp:946: updateTick(10766) received stateChanged peerID(1) oldState(ConnectedWaitingForMap) newState(ConnectedDownloadingMap)
  13.105 Info ServerMultiplayerManager.cpp:946: updateTick(10766) received stateChanged peerID(1) oldState(ConnectedDownloadingMap) newState(ConnectedLoadingMap)
  13.205 Info ServerMultiplayerManager.cpp:946: updateTick(10771) received stateChanged peerID(1) oldState(ConnectedLoadingMap) newState(TryingToCatchUp)
  13.222 Info ServerMultiplayerManager.cpp:946: updateTick(10772) received stateChanged peerID(1) oldState(TryingToCatchUp) newState(WaitingForCommandToStartSendingTickClosures)
  13.226 Info GameActionHandler.cpp:4994: UpdateTick (10772) processed PlayerJoinGame peerID(1) playerIndex(0) mode(connect)
  13.288 Info ServerMultiplayerManager.cpp:946: updateTick(10776) received stateChanged peerID(1) oldState(WaitingForCommandToStartSendingTickClosures) newState(InGame)
2022-01-24 16:21:52 [JOIN] orlea joined the game
  40.738 Info ServerMultiplayerManager.cpp:946: updateTick(12423) received stateChanged peerID(1) oldState(InGame) newState(DesyncedWaitingForMap)
  40.739 Info ServerMultiplayerManager.cpp:1035: updateTick(12423) received playerDesynced peer (1)
  40.741 Info ServerMultiplayerManager.cpp:797: updateTick(12423) changing state from(InGame) to(InGameSavingMapForDesyncReport)
  43.908 Info ServerMultiplayerManager.cpp:1013: UpdateTick(12423) Serving map(/home/aries/factorio/temp/mp-save-1.zip) for peer(1) size(1593070) crc(2515640094)
  43.908 Info ServerMultiplayerManager.cpp:797: updateTick(12423) changing state from(InGameSavingMapForDesyncReport) to(InGame)
  43.972 Info ServerMultiplayerManager.cpp:946: updateTick(12423) received stateChanged peerID(1) oldState(DesyncedWaitingForMap) newState(DesyncedCatchingUpWithMapReadyForDownload)
  43.988 Info ServerMultiplayerManager.cpp:946: updateTick(12423) received stateChanged peerID(1) oldState(DesyncedCatchingUpWithMapReadyForDownload) newState(DesyncedSavingLocalVariantOfMap)
  44.172 Info ServerMultiplayerManager.cpp:946: updateTick(12423) received stateChanged peerID(1) oldState(DesyncedSavingLocalVariantOfMap) newState(DesyncedDownloadingMap)
  44.688 Info ServerMultiplayerManager.cpp:946: updateTick(12423) received stateChanged peerID(1) oldState(DesyncedDownloadingMap) newState(DesyncedCreatingReport)
  44.822 Info ServerMultiplayerManager.cpp:1064: Disconnect notification for peer (1)
  44.822 Info ServerMultiplayerManager.cpp:946: updateTick(12430) received stateChanged peerID(1) oldState(DesyncedCreatingReport) newState(DisconnectScheduled)
2022-01-24 16:22:23 [LEAVE] orlea left the game
  44.824 Info ServerSynchronizer.cpp:627: nextHeartbeatSequenceNumber(2503) removing peer(1).
ShadF0x commented 2 years ago

From Factorio's wiki on the matter of multiplayer:

Factorio multiplayer code uses deterministic lockstep to synchronize clients. 
This is a method of synchronizing a game from one computer to another by sending only the user inputs 
that control that game, rather than networking the state of the objects in the game itself. 
It means that all player's games need to simulate every single tick of the game identically. 
If any computer does something ever-so-slightly different, a desynchronization (desync) occurs.

If you look at the desync report that the client generates, you will see that for any given state the server and the client generate different CRC values, because ARM and x86(_64) calculate these values differently.

In other words, Box64 has nothing to do with desyncs, the issue is the difference between CPU architectures.

rajdakin commented 2 years ago

In other words, Box64 has nothing to do with desyncs, the issue is the difference between CPU architectures.

Well, no, box64's goal is to emulate one architecture (x64) on the other (aarch64). So this issue is a box64 issue. The problem is that it will probably be hard to debug given a lack of starting debug point. (Note to anyone who wants to try: maybe "Info ServerRouter.cpp:623: Generated hmac(0VU5NKjkvIGONFMLHqAKpw==) and serverKey(SYwdXrw282EsFF71XEyriw==) for username(orlea) differ." is a good starting point?)

PS: if you are still playing Factorio, make sure to disable the "auto crash report" option so as to avoid confusing the devs who will see an x86-only CPU running Factorio 64 bits :p

rajdakin commented 2 years ago

It seems to be fixed with 55bc85365948ab70f62b4189ed9a5a64addf8e21 (ran the server using the latest full Factorio binary on the ARM64 machine and the client on an x86_64 machine). Can you try it?

orlea commented 2 years ago

I tried to run a multiplayer server on master branch ( 9e07083 ). I played for about 30 minutes and it appears to be completely fixed in my environment. Thanks!

nicball commented 2 years ago

I can't test myself now. But according to you guys, I am closing this issue. Thanks for your attention and efforts!

winszenYoung commented 1 year ago

The same problem occur latest version(1.1.69)

Test Environment

Oracle Cloud Infrastructure VM.Standard.A1.Flex Ubuntu 22.04 LTS Factorio 1.1.69

freehelpdesk commented 1 year ago

Still not resolved, please re-open.

freehelpdesk commented 1 year ago

Client

  15.005 Info GameActionHandler.cpp:5053: UpdateTick (20210) processed PlayerJoinGame peerID(1) playerIndex(0) mode(connect) 
  23.100 Info ClientSynchronizer.cpp:327: Latency changed to (13)
  28.100 Info ClientSynchronizer.cpp:327: Latency changed to (16)
  39.267 Error GameActionHandler.cpp:3595: Multiplayer desynchronisation: crc test (heuristic) failed for crcTick(21664) serverCRC(1865800133) localCRC(1368960633)
  39.268 Info ClientMultiplayerManager.cpp:610: UpdateTick(21665) changing state from(InGame) to(DesyncedWaitingForMap)
  39.367 Info ClientMultiplayerManager.cpp:741: updateTick(21666) received player (1) desynced
  40.200 Info ClientMultiplayerManager.cpp:747: Received mapReadyForDownload
  40.200 Info ClientMultiplayerManager.cpp:610: UpdateTick(21666) changing state from(DesyncedWaitingForMap) to(DesyncedCatchingUpWithMapReadyForDownload)
  40.200 Error GameActionHandler.cpp:3595: Multiplayer desynchronisation: crc test (heuristic) failed for crcTick(21665) serverCRC(708688592) localCRC(345034092)
  40.201 Error GameActionHandler.cpp:3595: Multiplayer desynchronisation: crc test (heuristic) failed for crcTick(21666) serverCRC(106157574) localCRC(956211642)
  40.217 Error GameActionHandler.cpp:3595: Multiplayer desynchronisation: crc test (heuristic) failed for crcTick(21667) serverCRC(1355164672) localCRC(1852529596)
  40.234 Error GameActionHandler.cpp:3595: Multiplayer desynchronisation: crc test (heuristic) failed for crcTick(21668) serverCRC(2858087435) localCRC(2499249079)
  40.251 Error GameActionHandler.cpp:3595: Multiplayer desynchronisation: crc test (heuristic) failed for crcTick(21669) serverCRC(1140927174) localCRC(2058116474)
  40.267 Error GameActionHandler.cpp:3595: Multiplayer desynchronisation: crc test (heuristic) failed for crcTick(21670) serverCRC(253008462) localCRC(834268658)
  40.284 Error GameActionHandler.cpp:3595: Multiplayer desynchronisation: crc test (heuristic) failed for crcTick(21671) serverCRC(1500871711) localCRC(1742212003)
  40.300 Error GameActionHandler.cpp:3595: Multiplayer desynchronisation: crc test (heuristic) failed for crcTick(21672) serverCRC(246679097) localCRC(806973829)
  40.317 Error GameActionHandler.cpp:3595: Multiplayer desynchronisation: crc test (heuristic) failed for crcTick(21673) serverCRC(737991684) localCRC(357673912)
  40.333 Error GameActionHandler.cpp:3595: Multiplayer desynchronisation: crc test (heuristic) failed for crcTick(21674) serverCRC(3514862330) localCRC(4012768582)
  40.353 Info ClientMultiplayerManager.cpp:610: UpdateTick(4294967295) changing state from(DesyncedCatchingUpWithMapReadyForDownload) to(DesyncedSavingLocalVariantOfMap)
  40.508 Downloading file /Users/brandon/Library/Application Support/factorio/temp/mp-download.zip (2671083 B, auxiliary 138 B, 5312 blocks)
  40.509 Info ClientMultiplayerManager.cpp:610: UpdateTick(4294967295) changing state from(DesyncedSavingLocalVariantOfMap) to(DesyncedDownloadingMap)
  41.347 Finished download (0 s, 2.6 MB, 3.1 MB/s)
  41.357 Info ClientMultiplayerManager.cpp:727: updateTick(4294967295) map download finished creating scenario
  41.357 Info ClientMultiplayerManager.cpp:610: UpdateTick(4294967295) changing state from(DesyncedDownloadingMap) to(DesyncedCreatingReport)

Server

31.341 Info GameActionHandler.cpp:5049: UpdateTick (20210) processed PlayerJoinGame peerID(1) playerIndex(0) mode(connect) 
  31.436 Info ServerMultiplayerManager.cpp:944: updateTick(20216) received stateChanged peerID(1) oldState(WaitingForCommandToStartSendingTickClosures) newState(InGame)
2023-01-05 14:05:00 [JOIN] crypticplank joined the game
  55.770 Info ServerMultiplayerManager.cpp:944: updateTick(21676) received stateChanged peerID(1) oldState(InGame) newState(DesyncedWaitingForMap)
  55.770 Info ServerMultiplayerManager.cpp:1029: updateTick(21676) received playerDesynced peer (1)
  55.772 Info ServerMultiplayerManager.cpp:795: updateTick(21676) changing state from(InGame) to(InGameSavingMapForDesyncReport)
  56.591 Info ServerMultiplayerManager.cpp:1005: UpdateTick(21676) Serving map(/home/container/temp/mp-save-1.zip) for peer(1) size(2671083) auxiliary(138) crc(780378697)
  56.591 Info ServerMultiplayerManager.cpp:795: updateTick(21676) changing state from(InGameSavingMapForDesyncReport) to(InGame)
  56.703 Info ServerMultiplayerManager.cpp:944: updateTick(21676) received stateChanged peerID(1) oldState(DesyncedWaitingForMap) newState(DesyncedCatchingUpWithMapReadyForDownload)
  56.853 Info ServerMultiplayerManager.cpp:944: updateTick(21676) received stateChanged peerID(1) oldState(DesyncedCatchingUpWithMapReadyForDownload) newState(DesyncedSavingLocalVariantOfMap)
  57.003 Info ServerMultiplayerManager.cpp:944: updateTick(21676) received stateChanged peerID(1) oldState(DesyncedSavingLocalVariantOfMap) newState(DesyncedDownloadingMap)
  57.853 Info ServerMultiplayerManager.cpp:944: updateTick(21676) received stateChanged peerID(1) oldState(DesyncedDownloadingMap) newState(DesyncedCreatingReport)
  58.003 Info ServerMultiplayerManager.cpp:1058: Disconnect notification for peer (1)
  58.003 Info ServerMultiplayerManager.cpp:944: updateTick(21684) received stateChanged peerID(1) oldState(DesyncedCreatingReport) newState(DisconnectScheduled)

Seems to be regression or a new issue based on https://github.com/ptitSeb/box64/issues/211#issuecomment-1022430512

dn9uyen commented 1 year ago

I have the exact same issues. This seems to be at least partly related to Factorio itself. I compiled 8d9c6b2 with dynarec enabled on Ubuntu 22.04 LTS. I'm using the headless server version of Factorio. The game seems to only desync on Factorio versions above 1.0.0. So workaround is to just run Factorio 1.0.0. Can anyone else confirm that versions >1.0.0 desync, but 1.0.0 is fine?

catgirlcataclysm commented 5 months ago

Im running into the same issue on factorio version 1.1.101, ubuntu 22.04.3 aarch64

ptitSeb commented 5 months ago

Ah still happening with latest version? Are both server and client running with box64 or only the server (and client is x64)?

nicball commented 5 months ago

I ran headless server version 1.1.96 through 1.1.101 on box64, with x64 clients, and it worked fine.

Maybe they were referring to running the client with box64?

catgirlcataclysm commented 5 months ago

or only the server (and client is x64)?

Yeah, Client is x64, server is aarch64 running box64 sorry for the late reply, I didn't notice the notification and just now checked lol

Im going to try again to set it up and run to see if I can narrow down the issue

catgirlcataclysm commented 5 months ago

I believe it works now, but i need to do further testing

catgirlcataclysm commented 4 months ago

I believe it works now, but i need to do further testing

Since then I have had no further issues.

ptitSeb commented 4 months ago

so, ticket can be closed?

catgirlcataclysm commented 4 months ago

so, ticket can be closed?

I apologize, I did not notice the notification. Unless somebody else is having an edge case problem, I'd think so.

rajdakin commented 1 week ago

Closing now (no reply from OP since last request).