Closed Dfred closed 1 year ago
Confirmed on Godot 4.0 Beta 7
I'll try to figure out if this is an actual godot-sqlite issue or if it is a generic godot-cpp issue instead.
Also is this related to #102 ?
Also is this related to #102 ?
not to my knowledge but it could be.. #102 was specific to downloaded Windows artifacts, and this one also occurs when I compile the lib, so I can't say.
I've seemingly pinpointed the issue to the following line:
void SQLite::do_something(String some_string)
{
const CharString dummy_path = some_string.utf8();
}
Calling this method works fine when exporting a debug build, but crashes when exporting to a release build.
This is also confirmed by the Valgrind crash dump.
There's already an issue describing this exact crash in the main godot repository here: https://github.com/godotengine/godot/issues/66846
We'll have to wait until that issue gets resolved before this issue is fixable 😢
I've seemingly pinpointed the issue to the following line:
void SQLite::do_something(String some_string) { const CharString dummy_path = some_string.utf8(); }
Calling this method works fine when exporting a debug build, but crashes when exporting to a release build.
This is also confirmed by the Valgrind crash dump.
Alright this makes a lot of sense :)
Good work pinning this down, let's hope this gets fixed soon. However I'm curious why it's still there as it is reported since Sep. and affects both 3.5.1 and 4-beta versions. Also, dropping here link to godot-cpp#842 that centralizes most related issues.
Oh so this is why my release builds have been broken. I've just been assuming it was GDScript 2.0 parsing bugs still.
Applying https://github.com/godotengine/godot-cpp/compare/master...lightyears1998:godot-cpp:fix-heap-corruption to godot-cpp allows it to build. Unknown consequences for godot-cpp as a whole, but it does allow you to export your project in the mean time.
thanks for the info Chris. Much appreciated.
@2shady4u good news! godot-cpp/#842 has just been closed. It is quite likely that this issue will be closed soon too ;-)
@Dfred @cridenour I have recompiled and tested the demo project for Godot 4.0 rc3 and am pleased to announce that the release build isn't crashing immediately anymore! 😄
I have some new issue that I'll have to check which happens in both debug and release builds:
But I think we can close this issue 🥳
I've been able to fix the issue above by removing the flush()
-method call in the VFS and replacing it with a normal close()
-call.
Flushing a packaged file seems to return a non-crashing error in Godot 4.0
I'll take full credit for lamenting about the issue in the Godot RocketChat :joy:
Environment:
Issue description: When exporting projects, release versions that use godot-sqlite successfully load the shared library but crash with 'free(): invalid size' when calling open_db(). Same exact code works when exported as debug.
Steps to reproduce: create a new project & scene with addon/godot-sqlite compiled for your godot4 version. Copy&paste below code. Export project as debug - see it runs as expected, then export project as release. Run and see that last print is never displayed and a core has been dumped (if your system allows it).
Minimal reproduction project:
Additional context tested with godot4-beta[1-6], confirmed issue with valgrind (which preserves a little bit further the stack):