godot: Running a scene/game from the editor makes the game crash after one frame
Operating system or device - Godot version: Arch Linux 64 Bit, current master
Issue description (what happened, and what was expected): When trying to run a scene or the whole project from the editor the game crashes after one frame.
_ready() run fine and _process() runs once. After that the window just closes without further information.
Running the project from a terminal works just fine.
Steps to reproduce: Open a project in the editor and try to run it. Try to run a scene from the editor. Try to do the same but from a terminal.
Link to minimal example project (optional but very welcome): test.zip
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 29 (26 by maintainers)
Commits related to this issue
- Fix a pesky bug in marshalls.cpp/encode_variant Fixes #7556 running game from editor on LLVM builds. — committed to bojidar-bg/godot by bojidar-bg 7 years ago
- Fix a pesky bug in marshalls.cpp/encode_variant Fixes #7556 running game from editor on LLVM builds. — committed to groscalin/godot by bojidar-bg 7 years ago
Reopening as I found a fix and with that the culprit.
I like LLVM. So I always use
use_llvm=yeswhen building Godot. If I compile with clang this bug occurs. If I compile with gcc everything is fine.The problems has to lie in the profiler/debugger. I once saw the famous
shit?: ...error, so there’s something going on with closing connections.Found the bug.
core/io/packet_peer.cpp:91usesallocato allocate the memory that holds the package content.The call to
put_packet()causes a segfault, I still don’t know why, but I changed the allocation to usememalloc()and free it withmemfree()afterwards.I suspect alignment to be the problem here, I’m not sure though. I’m looking for a nicer fix, because allocating heap memory so frequently will result in bad performance.
This is my first time using
gdbso I could be wrong, but I think I narrowed it down to a segfault in the launched game process.Backtrace:
Frame info:
with the local variables as:
Can confirm that I also run into this bug if I build the latest master (1c480698ce0e881cbd28f1f0ddba95cee74ca834) with LLVM on Arch Linux, (x64) but not if I build with gcc.