Deterministic multithreading is hard (2024)

https://news.ycombinator.com/rss Hits: 10
Summary

Hello, While a lot of time of 2.0 development has been spent on new features and quality of life, we still take care of the smaller details and technical improvements. Deterministic multithreading is hard Recently a desync bug was reported to us involving the modding API and multiple Windows and Linux computers that the player was using. My first instinct was to blame the mod developer for doing something wrong but I've seen enough bug reports over the years to know dismissing one without first investigating is a bad idea and a great way to eat crow. I could not reproduce the desync, but the player was able to with ease. At first I thought it was a Windows vs Linux issue (we've had many of those), but then the player was able to reproduce it with Linux on both computers. Next I thought it was a hardware problem, we've seen our share of faulty computers that just don't do what they're supposed to do. Convincing someone their hardware is broken is difficult and time consuming in the best scenarios. After several failed attempts to reproduce the issue on my one computer, Boskid, using his multiple computers was able to. Being able to reproduce bugs locally is I guess around 90-95% of the time spent fixing reported bugs. With Boskid reproducing the issue on demand he was able to narrow it down to the fact the computers had a different number of CPU cores. With that newfound knowledge he was able to make a test that could be run on my single computer to reproduce the desync by artificially pretending I had less CPU cores than I did. The problem ended up needing 4 different moving pieces to all come together to expose a threading determinism issue that has been in the game since I put it there in July 22, 2017. A mod needed to listen to the chunk generated event and change the tiles on a chunk when it happened. A mod needed to request several chunks be generated. A mod needed to force all requested chunks to be generated right now. The game needed to be run on two compute...

First seen: 2025-10-19 22:02

Last seen: 2025-10-20 07:04