-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ThorVG regression causing potentially corrupted SVGs #87962
Comments
Done this and rescaled many times to different sizes, can't reproduce (Debian 12, Ubuntu...). |
How strange, I'm just using the editor as normal, I made sure that my c++ code wasn't the culprit 🤔 I'll try a few things and let you know |
|
I'm able to reproduce this issue and disabling multiple threads for the import process will correctly import the SVGs. The issue is not ThorVG (I think) but a race condition in the import process. Like capnm previously mentioned, this issue ties back to #84364. |
Since I am not able to reproduce the problem myself, could you try to find a latest version of Godot4 where this issue does not occur? Thank you! |
Read the last comment: "I'm able to reproduce the crash but I don't think it's related to ThorVG -- the crash happens at different places and due to double frees or some memory corruption. The root cause is most likely a race condition." |
Well the fact is that reverting #87612 appears to solve the bug according to @RevoluPowered. So it is related to the ThorVG change, even if the actual crash doesn't happen in ThorVG. That change is triggering something which may be a pre-existing Godot issue but understanding why ThorVG's new threading changes trigger it would be helpful. |
I can try but it may be hard for me to pinpoint the version -- it was likely introduced before 4.1.1 and some versions before that Godot didn't work on my system for some reason. I'll try to bisect later. For now I finally got ThreadSanitizer to work on my system -- here's the log that includes the thread issues it detected during the import process of the SVGs in this issue. Note that the first data race it detects is in SUMMARY: ThreadSanitizer: data race /opt/godot/editor/editor_file_system.cpp:2301:93 in EditorFileSystem::_reimport_thread(unsigned int, EditorFileSystem::ImportThreadData*) I didn't check everything, but most, if not all, the other data races ThreadSanitizer detected have The thread sanitizer log was created with a build from 63d6bda and by running the following at the project path:
The output is very verbose and it generates about 598MB of text before reaching the import process. I'll be opening a new issue to cover those other issues detected by ThreadSanitizer. |
Hello, here are my idea.
Thanks. |
I can reproduce the issue on Linux, and as @hermet identified, enabling The changes in #87612 indeed made it opt-in via a define, when it used to be always enabled. So we need to make sure to set that define (that's good to keep in mind for future updates @capnm, when new defines are added upstream we need to make sure to evaluate if we need them too). @adamscott This might be useful for the no-threads web build btw. For now I'll make a PR restoring the previous behavior where threads are always enabled, but this would be worth looking into further for web, and assing points 2 from @hermet's comment. |
@akien-mga Threads are already disabled for the no-threads builds already. godot/modules/svg/register_types.cpp Lines 37 to 54 in 36e943b
I imagine that we could just turn off the threads for every build. |
Somebody needs first to fix the real issue described by @Rubonnek that it triggers. |
Fixes godotengine#87788. Fixes godotengine#87962. (cherry picked from commit 2e32b93)
Tested versions
System information
Arch Linux
Issue description
When rendering SVGs using
ImageLoaderSVG::create_image_from_utf8_buffer
(I'm doing it from C++, but I can't see why it wouldn't affect godot proper too) the rendered images sometimes come out corrupted, an example:I believe it may be a ThorVG bug, since if I downgrade to thorvg 0.12.1 it works fine, but the issue is introduced in 0.12.2
Steps to reproduce
Minimal reproduction project (MRP)
mrp.zip
The text was updated successfully, but these errors were encountered: