Crash on Linux. Tilemaps related bug?

Hi everyone,

I have an issue where the game crashes when built on Linux.
The editor provides a crash log, I tried to investigate but didn’t understand anything.
The crash does not happen on macOS, did not test on windows yet.
However, the crash does not happen at game start, the main menu works well. It seems to be related to the number of tilemaps present in the game. I use a lot of small tilemaps and when I disable this system, the game works fine on both OS.

��1.2.1448def4b50c9aa049670e698d7dff3dc00d77e42d5Linux4.13.0-46-genericenen-US.UTF8dmenginelibXdmcp.so.6.0.0libXau.so.6.0.0libbsd.so.0.8.6libasound.so.2.0.0libXext.so.6.4.0libnvidia-glcore.so.390.25libnvidia-glcore.so.390.25libnvidia-glcore.so.390.25libnvidia-tls.so.390.25libxcb.so.1.1.0librt-2.26.solibsndio.so.6.1libc-2.26.solibgcc_s.so.1libm-2.26.solibstdc++.so.6.0.24libdl-2.26.solibpthread-2.26.solibGLU.so.1.3.1libGL.so.390.25libGL.so.390.25libGL.so.390.25libX11.so.6.3.0libopenal.so.1.17.2ld-2.26.sold-2.26.sold-2.26.so@�Qӣ�qӣ �ӣp�ӣ��ӣԣ�FգIգ@�գ�֣�#֣pD֣pe֣p�֣��֣@�֣�2ף�Rף�tף��ףP�ף��ף��ף أ-أ.أ .أ
                                        ��f@�h֣.F1FY
W��W�XWY�@�`G��@��@2�@��g֣��@/home/zac/.Defold/unpack/e6badbdfbe3d296da36f9f8e2e4848ffdfb9a971/x86_64-linux/bin/dmengine() [0x669a86]
/lib/x86_64-linux-gnu/libc.so.6(+0x37140) [0x7fa3d668e140]
/home/zac/.Defold/unpack/e6badbdfbe3d296da36f9f8e2e4848ffdfb9a971/x86_64-linux/bin/dmengine() [0x462e1a]
/home/zac/.Defold/unpack/e6badbdfbe3d296da36f9f8e2e4848ffdfb9a971/x86_64-linux/bin/dmengine() [0x463113]
/home/zac/.Defold/unpack/e6badbdfbe3d296da36f9f8e2e4848ffdfb9a971/x86_64-linux/bin/dmengine() [0x570a59]
/home/zac/.Defold/unpack/e6badbdfbe3d296da36f9f8e2e4848ffdfb9a971/x86_64-linux/bin/dmengine() [0x5788bf]
/home/zac/.Defold/unpack/e6badbdfbe3d296da36f9f8e2e4848ffdfb9a971/x86_64-linux/bin/dmengine() [0x5758a3]
/home/zac/.Defold/unpack/e6badbdfbe3d296da36f9f8e2e4848ffdfb9a971/x86_64-linux/bin/dmengine() [0x40d059]
/home/zac/.Defold/unpack/e6badbdfbe3d296da36f9f8e2e4848ffdfb9a971/x86_64-linux/bin/dmengine() [0x476096]
/home/zac/.Defold/unpack/e6badbdfbe3d296da36f9f8e2e4848ffdfb9a971/x86_64-linux/bin/dmengine() [0x40fac7]
/home/zac/.Defold/unpack/e6badbdfbe3d296da36f9f8e2e4848ffdfb9a971/x86_64-linux/bin/dmengine() [0x40fb95]
/home/zac/.Defold/unpack/e6badbdfbe3d296da36f9f8e2e4848ffdfb9a971/x86_64-linux/bin/dmengine() [0x40b932]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf1) [0x7fa3d66781c1]
/home/zac/.Defold/unpack/e6badbdfbe3d296da36f9f8e2e4848ffdfb9a971/x86_64-linux/bin/dmengine() [0x40b7a9]

Does anyone know what could be responsible for this ?

Update :
It seems not to be related specifically to the use of a lot of small tilemaps.
All my small tilemaps have a script attached. When this script is removed, the game works fine.
This script is mainly responsible for modifying the tilemap it is attached to.

Update 2 :
Tried on Windows 10, the game did crash as on Linux but this time the editor did not provide any crash log.

Hi, can you please zip the project and share it with me (bjorn.ritzl@king.com) so that I can take a look on Monday?

2 Likes

Did it say anything about writing a crash log? ("_crash")
That file would be very useful

Edit:
By looking at the callstack, it seems to confirm some issue inside the tilegrid:

~/defold $ gaddr2line -e dmengine 0x462e1a
./src/gamesys/components/comp_tilegrid.cpp:361
~/defold $ gaddr2line -e dmengine 0x463113
./src/gamesys/components/comp_tilegrid.cpp:438
~/defold $ gaddr2line -e dmengine 0x570a59
./src/render/render.cpp:600

As @btrizl says, it would be great if yiou could share the project so we can take a look at this crash.

2 Likes

Thanks folks you’re very helpful :grinning: !

The code attached to my first post is the crash log located in my home directory in a hidden folder named “.Defold”. The name of the file is _crash but I couldn’t open it with a text editor. What you see is the result of a “cat” command of the file.

I’ve sent my project zipped to @britzl.

I will continue to investigate and answer any questions you may have !

I found the issue and Will have a ”fix” in the next release. Actually, you managed to trigger a case in the set_tilemap function that wasnt caught before but should never have worked :slight_smile:)

Essentially you are passing in tile indices that are out of bounds from the tilesource (-1 and 100 in your case) which causes a bad memory exec on linux (and macOS when compiling with memory guard tools). Not sure if we will fail silently or yield a lua error as a fix. Probably the latter, which means that you Will have to do bound checks yourself.

5 Likes