Engine: BSD: Address SIGSEGV error on Loading / Creating a Project
Description
The editor partially loads the project and then crashes after a few seconds. It immediately crashes after project creation.
Prerequisites
Was on the project selection screen waiting to open a project.
Steps to Reproduce
- Build latest source code with CMake.
- Install to the SDK build directory using
gmake install - Run WorldEditor from inside of
install-root/sdk/2024.2/freebsd/x86/bin/directory - Load up or create new project.
Expected behavior:
Full editor loads.
Actual behavior:
Crashes while loading editor and engine.
Reproducibility:
Consistently.
Versions
Additional Information
I decided to run both gdb and Valgrind to get to the bottom of this. Attached is the Valgrind log.
Note the Invalid write of size 8 on line 400 and then the Address 0x70 is not stack'd on line 413. There's other errors but MaterialInstance::setTransform is the crashing function in both debugger applications.
I'm not fully sure how to fix this yet but this may be related to the crashes others have been running into.
Seems like the issue in Renderable::setMaterialsList some materials was nullptr and have not created an instance for it. Which leads to nullptr exception
Have added a checker. But I assume some standard resources was not installed properly because of CMake build
That's part of why I might attempt to build Qt from source. Many of the libraries (especially the standard ones outside of the current build system) are ports of the Linux ones. I noticed several Qt library related errors in that log
it's not related Qt. Please check resources dir in SDK
Running gmake install produces this:
CMake Error at build/cmake_install.cmake:45 (file):
file INSTALL cannot find "/plugins/imageformats": No such file or
directory.
Call Stack (most recent call first):
cmake_install.cmake:48 (include)
and then it complains about not having a local Qt installation and errors out with that too if I comment this out in build/cmake_install.cmake
it's CMake issues imageformats is directory not file
There's no .embedded folder so it throws this also when loading: [ FileIO ] Can't open file .embedded/DefaultMesh.shader
Thank you for your patience, by the way. We got this. I implemented your current commit manually and still getting a crash but also it loaded a bit further. Debugging now
.embedded is "virtual" directory. it's means this resource located NOT in project directory. It has many inputs most of them in "resources" directory. Check SDK build from the archive which I mentioned yesterday
It's not in the Linux one. I'll try from the Windows archive.
I mean the .embedded doesn't exist. Should it? I've already copied that folder from the Linux archive. Copying from the Windows one to see if there's a difference
.embedded doesn't exist on disk. It's just alias which points to files in "resources" directory. I have added it to separate game project resources from basic ones.
Yeah, platform release doesn't matter in this case. It's in the code.
Implementing your fix and adding a couple more checks, I was able to get this stacktrace with gdb:
0x0000000823e8c516 in PipelineContext::draw(Camera*) ()
from /home/brad/git/thunder-build/install-root/sdk/2024.2/freebsd/x86/bin/../lib/libengine-editor.so
(gdb) backtrace
#0 0x0000000823e8c516 in PipelineContext::draw(Camera*) ()
at /home/brad/git/thunder-build/install-root/sdk/2024.2/freebsd/x86/bin/../lib/libengine-editor.so
#1 0x0000000823ef3246 in RenderSystem::update(World*) ()
at /home/brad/git/thunder-build/install-root/sdk/2024.2/freebsd/x86/bin/../lib/libengine-editor.so
#2 0x000000089dad2358 in RenderGLSystem::update(World*) ()
at /home/brad/git/thunder-build/install-root/sdk/2024.2/freebsd/x86/bin/plugins/librendergl-editor.so
#3 0x0000000823ef370a in RenderSystem::renderOffscreen(World*, int, int) ()
at /home/brad/git/thunder-build/install-root/sdk/2024.2/freebsd/x86/bin/../lib/libengine-editor.so
#4 0x000000089dad23cb in RenderGLSystem::renderOffscreen(World*, int, int) ()
at /home/brad/git/thunder-build/install-root/sdk/2024.2/freebsd/x86/bin/plugins/librendergl-editor.so
#5 0x000000000032c6d1 in IconRender::render(QString const&, QString const&) ()
#6 0x0000000000332282 in ImportQueue::onImportFinished() ()
#7 0x0000000000333f2b in QtPrivate::FunctorCall<QtPrivate::IndexesList<>, QtPrivate::List<>, void, void (ImportQueue::*)()>::call(void (ImportQueue::*)(), ImportQueue*, void**) ()
#8 0x0000000000333e9d in void QtPrivate::FunctionPointer<void (ImportQueue::*)()>::call<QtPrivate::List<>, void>(void (ImportQueue::*)(), ImportQueue*, void**) ()
#9 0x0000000000333de2 in QtPrivate::QSlotObject<void (ImportQueue::*)(), QtPrivate::List<>, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) ()
#10 0x000000082e656672 in ??? () at /usr/local/lib/qt5/libQt5Core.so.5
#11 0x0000000823f19fd5 in AssetManager::importFinished() ()
at /home/brad/git/thunder-build/install-root/sdk/2024.2/freebsd/x86/bin/../lib/libengine-editor.so
#12 0x0000000823e03a5f in AssetManager::onPerform() ()
at /home/brad/git/thunder-build/install-root/sdk/2024.2/freebsd/x86/bin/../lib/libengine-editor.so
#13 0x0000000823f19b08 in AssetManager::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) ()
at /home/brad/git/thunder-build/install-root/sdk/2024.2/freebsd/x86/bin/../lib/libengine-editor.so
#14 0x000000082e656736 in ??? () at /usr/local/lib/qt5/libQt5Core.so.5
#15 0x000000082e65b803 in QTimer::timerEvent(QTimerEvent*) () at /usr/local/lib/qt5/libQt5Core.so.5
#16 0x000000082e64b5b7 in QObject::event(QEvent*) () at /usr/local/lib/qt5/libQt5Core.so.5
#17 0x0000000827c99b43 in QApplicationPrivate::notify_helper(QObject*, QEvent*) ()
at /usr/local/lib/qt5/libQt5Widgets.so.5
#18 0x0000000827c9aeee in QApplication::notify(QObject*, QEvent*) ()
at /usr/local/lib/qt5/libQt5Widgets.so.5
#19 0x000000082e622df1 in QCoreApplication::notifyInternal2(QObject*, QEvent*) ()
at /usr/local/lib/qt5/libQt5Core.so.5
#20 0x000000082e6748b4 in QTimerInfoList::activateTimers() () at /usr/local/lib/qt5/libQt5Core.so.5
#21 0x000000082e676381 in ??? () at /usr/local/lib/qt5/libQt5Core.so.5
#22 0x0000000837a13ee1 in ??? () at /usr/local/lib/libglib-2.0.so.0
#23 0x0000000837a1428f in ??? () at /usr/local/lib/libglib-2.0.so.0
#24 0x0000000837a14326 in g_main_context_iteration () at /usr/local/lib/libglib-2.0.so.0
#25 0x000000082e675915 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/local/lib/qt5/libQt5Core.so.5
#26 0x000000082e61f786 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) ()
at /usr/local/lib/qt5/libQt5Core.so.5
#27 0x000000082e623471 in QCoreApplication::exec() () at /usr/local/lib/qt5/libQt5Core.so.5
#28 0x000000000030d5d4 in main ()
I can assume pipeline was not fully loaded. Could you check if pipeline tools plugin loaded? Pipeline is a special game resource which describes the order to render image and tasks were needed to render it.
[PluginManager] Can't load plugin: /home/brad/git/thunder-build/install-root/sdk/2024.2/freebsd/x86/bin/plugins/libpipelinetools.so
[PluginManager] Can't load plugin: /home/brad/git/thunder-build/install-root/sdk/2024.2/freebsd/x86/bin/plugins/libshadertools.so
[PluginManager] Can't load plugin: /home/brad/git/thunder-build/install-root/sdk/2024.2/freebsd/x86/bin/plugins/libmotiontools.so
Right on the money.
When I get off of work, I found some more places some checks can be added. Probably won’t fully solve the underlying problem but your suggestions have given me a direction on what to look for while I have downtime at work.
I think you should check dependencies for this plugins using ldd or analog on BSD platform. They all uses grapheditor module
Got it. I’ll still implement those checks locally since they won’t harm anything. There’s no library linkage errors left for the builds so far but I can recheck after work.
My assumptions are it’s the platform and system libraries first over your code for the same reasons you’ll suggest it’s directly related to your code and your build system. I’m enjoying working on this, to be honest. Thank you.😎
Yes it's bit addictive =)
Took a glance at the CMake files for all the unloaded plugins and they should link correctly. graph-editor is a dependency in all. I don’t have a Linux install right now but building a version with CMake and running natively from those builds could rule out if it’s the platform or the CMake build system. Getting a VM setup with an install to test on should be doable on my end. It doesn’t even need to run well, just be able to build and launch the editor.
That stacktrace brought up a Camera pointer. There’s at least one unchecked one in Pipelinecontext that could be null. I took a brief look at the RenderSystem and RenderGLSystem code and didn’t see anything right off the bat.
I’ll check the fonts too. The crash happens right after they get loaded in and sometimes they and certain image formats will get mangled by git when cloning from my experiences. It’s a known bug that pops up every so often with the git port on the platform.
When you setup the CMake system, did you assume a build inside tree or in an external folder? I think I found one of the problems.
I’m also confused about how the engine creates the virtual resource directory. I see the code looking for the resources and then assuming .embedded exists in memory. Definite black magic to me. That’s why I wasn’t sure if I should look for a hidden folder in the resources folder or not.
I think you should check dependencies for this plugins using ldd or analog on BSD platform. They all uses grapheditor module
Just got home from work. Here's the BSD libraries, plugins and executables ldd logs. There's nothing that's linked wrong as far as I can see. ldd-logs.zip
My current assumption is that each of the failed plugins generated a warning of some type that I mindlessly didn't think much of. I'm building them individually and piping the warnings to a log. I'm also comparing my findings to the previous Linux build logs from your runners. I found some possible leads. Will post my findings here in a bit.
This doesn't exist in the other logs and is mighty suspicious to me:
/home/brad/git/thunder/engine/includes/editor/converters/animconverter.h:0: Note: No relevant classes found. No output generated.
Here's the source code for that: https://github.com/thunder-engine/thunder/blob/master/engine/includes/editor/converters/animconverter.h
And attached is the warning log for pipelinetools. It's not generating all of the headers even though they have no issues with the Linux build.
Seems to be not relevant or useful. It's just a standard moc warning stating that it doesn't need to process that header.
When you setup the CMake system, did you assume a build inside tree or in an external folder? I think I found one of the problems.
I’m also confused about how the engine creates the virtual resource directory. I see the code looking for the resources and then assuming
.embeddedexists in memory. Definite black magic to me. That’s why I wasn’t sure if I should look for a hidden folder in the resources folder or not.
I think I forgot to prepare right install instructions fro CMake. Me personally using QBS because it's convenient to use it in Qt Creator IDE
I think you should check dependencies for this plugins using ldd or analog on BSD platform. They all uses grapheditor module
Just got home from work. Here's the BSD libraries, plugins and executables ldd logs. There's nothing that's linked wrong as far as I can see. ldd-logs.zip
Ok seems like all dependencies were resolved. Then it's missilery why it don't loading =/