When developing Korman's "Test Age" feature, I noticed a curious bug that I could never quite understand. The feature basically uses hsFileStream to modify the TPotS vault.dat, then launches Uru. Occassionally, however, Uru would act as if the changes to the vault were not made - but according to VaultShop, the changes were present! I discovered that adding a small sleep between writing vault.dat and launching Uru made the process slightly more reliable, but still not 100%.
As it turns out, the C file API in Windows is evidentally vulnerable to race conditions where changes are not flushed out as expected. I'm not mthe only one to discover this problem: https://twitter.com/jonathan_blow/status/1417544504916135936
When developing Korman's "Test Age" feature, I noticed a curious bug that I could never quite understand. The feature basically uses
hsFileStream
to modify the TPotS vault.dat, then launches Uru. Occassionally, however, Uru would act as if the changes to the vault were not made - but according to VaultShop, the changes were present! I discovered that adding a small sleep between writing vault.dat and launching Uru made the process slightly more reliable, but still not 100%.As it turns out, the C file API in Windows is evidentally vulnerable to race conditions where changes are not flushed out as expected. I'm not mthe only one to discover this problem: https://twitter.com/jonathan_blow/status/1417544504916135936