Open IamTheCarl opened 2 years ago
I have log files from other users getting similar errors, but triggered by different lines from this file: https://github.com/Zylann/godot_voxel/blob/godot3.4/streams/region/region_file.cpp#L371 https://github.com/Zylann/godot_voxel/blob/godot3.4/streams/region/region_file.cpp#L416
How large is the region file? Any errors prior to the fatal one?
The only possibilities that come to mind are:
sizeof(int)
in the code is not portable and should probably be changed, however on Windows it is 32-bit so that's unlikely to be the issue.Do you have a minimal project reproducing the issue?
I can see if I can produce a minimal reproduction of the bug, but since I'm suspicious the compiler is part of the issue, I'm not sure how to get that to you if it is.
Can you make use of a Docker container?
Would it be better if I just gave you access to view my whole project's repository? It too is built with a Docker container, so if you have Docker, you won't need to install anything else to build it.
I have no experience with Docker at all. I think if you can reproduce on Windows using MSVC, then I should be able to reproduce as well.
I develop primarily on Linux so that is, unfortunately, a rather difficult setup for me to make. I'll see if I can diagnose the issue myself.
Give me a few minutes to make a plan. I think we can both benefit if I do this right.
Here is your minimal reproduction of the bug. WARNING: There's a lot of flashing since it's just rapidly modifying and saving terrain as fast as it possibly can.
The number of saving cycles it goes through before a crash happens seems kinda random. :(
I see it's not been made explicit yet in this issue, so here is the relevant code from the godot3.x
branch:
The error occurs if the check at the last line fails.
As you might notice, there aren't many possible causes for that. It really looks like get_position()
returns an unexpected value, or store_buffer
did not write the expected amount of bytes...
Some more notes:
sizeof(int)
could be a problem, and was replaced with sizeof(uint32_t)
in the master
branch. But even then, after some other testing, it sounds like it's not really the issue.master
writing/reading from region files, and so far none of them were able to reproduce this, at least on Windows with MSVC.Moving the insight found in https://github.com/Zylann/godot_voxel/issues/365 so I can close the duplicate:
In the Godot 3.x Mono Builds of the Github Actions CI as it is now, FileAccess::get_position()
does not work correctly. It returns a position as if the file was open in text mode.
There is no text mode in Godot. All files are supposed to be binary. Therefore there is no code fix available at the moment.
An example in how it manifests is, if you store 10 bytes containing the value 10
(which corresponds to the character \n
), then FileAccess::get_position()
returns 20
, instead of 10
, even though only 10 bytes actually get written. This can cause nasty bugs with binary save files.
On Windows, files are open in binary mode here: https://github.com/godotengine/godot/blob/33500a1529ba1fb0e471aea0e4af3e704619a828/drivers/windows/file_access_windows.cpp#L61
And uses _ftelli64
to obtain the position: https://github.com/godotengine/godot/blob/33500a1529ba1fb0e471aea0e4af3e704619a828/drivers/windows/file_access_windows.cpp#L210
However _fseeki64
and fseek
seem to be used quite inconsistently. Not sure if that's supposed to have an impact.
It is currently unknown why this happens in that specific build, this needs to be investigated.
You can verify if your Godot version has this bug by running this minimal project: https://github.com/Zylann/godot_voxel/files/8403297/StoreBuffer.zip
Current workarounds:
VoxelStreamSQLite
instead of VoxelStreamRegionFiles
My windows users are experiencing the following error. I am able to replicate it under Wine on my Linux system as well.
Branch info:
Windows cross compiler info:
Is there any additional information I can provide that is helpful?