Crash when running game fullscreen

I just had a crash when running my game in fullscreen from the editor (the editor didn’t crash). Here’s the bit from the console and I’ve uploaded the referenced file (_crash.zip).

macOS 11.4, MBP 13", 2020, 2.3 GHz, i7, 32GB, Intel Iris Plus Graphics 1536MB
I'm also running an external 4K LG Monitor.

INFO:DLIB: Log server started on port 51342
INFO:ENGINE: Target listening with name: MacBook-Pro.local - ::1 - Darwin
INFO:ENGINE: Engine service started on port 51343
INFO:ENGINE: Defold Engine 1.2.184 (1f57126)
2021-07-13 08:33:10.308 Defold[2860:102994] void * _Nullable NSMapGet(NSMapTable * _Nonnull, const void * _Nullable): map table argument is NULL
WARNING:GRAPHICS: Trying OpenGL 3.1 compat mode
INFO:CRASH: Successfully wrote Crashdump to file: /Users/bryanrieger/Library/Application Support/Defold/_crash
ERROR:CRASH: CALL STACK:

#0 pc      0x91d7d libc++abi.dylib _sigtramp+29

_crash.zip (2.3 KB)

Can you reproduce the crash?

Yup. I’ve attached the macOS generated crash report.

Tick ‘Display > Fullscreen’. Run via ⌘ + B. Both the Mac and the external screens go black, Apple Music stops, then everything appears again (incl. Apple Music starting to play again) and the crash report prompt is shown.

I even get this behaviour on a new, empty desktop project where the only thing I’ve done is check the ‘Display > Fullscreen’ checkbox.

Running without ‘Display > Fullscreen’ works just fine, and Apple Music also continues to play as expected. Also, attempting to run the project (in fullscreen) with nothing else open (just the Defold editor) results in the same crash of the runtime.

crash_report.txt (61.7 KB)

I will try this myself later. @JCash does the crash show anything meaningful to you?

Yes, looking in the crash_report.txt, it says:

Thread 0 Crashed:: engine_main  Dispatch queue: com.apple.main-thread
0   libsystem_platform.dylib      	0x00007fff20607552 _platform_strlen + 18
1   dmengine                      	0x0000000108a477a7 dmGraphics::OpenGLOpenWindow(dmGraphics::Context*, dmGraphics::WindowParams*) + 839
2   dmengine                      	0x00000001087e43dc dmEngine::Init(dmEngine::Engine*, int, char**) + 2492
3   dmengine                      	0x00000001087e7a27 dmEngineCreate(int, char**) + 71
4   dmengine                      	0x00000001087e7cff dmEngine::RunLoop(dmEngine::RunLoopParams const*) + 95
5   dmengine                      	0x00000001087e7c72 engine_main(int, char**) + 98
6   dmengine                      	0x00000001087e30d4 start + 52

We use strlen() in 3 places there, and I’m not yet sure which one is causing the problem.
I’ll make a special version with some more debug info you can test…

dmengine_beta185_ogl_debug.zip (2.4 MB)

If you could run this engine inside the project folder (after you’ve built your content. I.e. run it after the crash).

It should print out all the strings related to strlen() in the OpenGLOpenWindow function.

Paste the output here if you don’t mind.

How do I run the dmengine? Just run ./dmengine within the project folder, or does it need any arguments?

Just like you thought, using ./dmengine within the project folder.

1 Like

INFO:DLIB: Log server started on port 54101
INFO:ENGINE: Target listening with name: Bryans-MacBook-Pro.local - ::1 - Darwin
INFO:ENGINE: Engine service started on port 8001
INFO:ENGINE: Defold Engine 1.2.185 (ef87996)
2021-07-13 12:39:12.811 dmengine[5006:256631] void * _Nullable NSMapGet(NSMapTable * _Nonnull, const void * _Nullable): map table argument is NULL
WARNING:GRAPHICS: Trying OpenGL 3.1 compat mode
WARNING:GRAPHICS: MAWE: error?: 0
WARNING:GRAPHICS: MAWE: GL_NUM_EXTENSIONS: 32766
WARNING:GRAPHICS: MAWE: counting required size:
WARNING:GRAPHICS: MAWE: 0: ext: (null)
INFO:CRASH: Successfully wrote Crashdump to file: /Users/bryanrieger/Library/Application Support/Defold/_crash

ERROR:CRASH: CALL STACK:
#0 pc 0x91d7d libc++abi.dylib _sigtramp+29
zsh: segmentation fault ./dmengine

crash_report.txt (61.7 KB)
_crash.zip (2.1 KB)

1 Like

Yeah, 32766 extensions sounds very wrong, which is also proven by the fact that the glGetString() returns 0 for the first string.

dmengine_beta185_ogl_debug.zip (2.4 MB)

Here’s the next version (which uses glGetString(GL_EXTENSIONS); instead.
I wasn’t able to test it myself, since I cannot create that compatibility mode myself.

INFO:DLIB: Log server started on port 54143
INFO:ENGINE: Target listening with name: Bryans-MacBook-Pro.local - ::1 - Darwin
INFO:ENGINE: Engine service started on port 8001
INFO:ENGINE: Defold Engine 1.2.185 (ef87996)
2021-07-13 12:51:57.470 dmengine[5093:264470] void * _Nullable NSMapGet(NSMapTable * _Nonnull, const void * _Nullable): map table argument is NULL
WARNING:GRAPHICS: Trying OpenGL 3.1 compat mode
Assertion failed: (extensions), function OpenGLOpenWindow, file …/src/opengl/graphics_opengl.cpp, line 911.
INFO:CRASH: Successfully wrote Crashdump to file: /Users/bryanrieger/Library/Application Support/Defold/_crash
ERROR:CRASH: CALL STACK:

#0 pc 0x91d7d libc++abi.dylib _sigtramp+29
zsh: abort ./dmengine

_crash.zip (2.1 KB)
report.txt (59.9 KB)

2 Likes

Ok, thanks. Then I know for sure that the glGetString(GL_EXTENSIONS) won’t work.
Hmm, I’ll have to test it out more, on my own laptop, to see if I can reproduce it.

2 Likes

dmengine_beta185_ogl_debug.zip (5.0 MB)

Here’s another one with a potential fix.
I’ve also added a ticket: Game crashes on fullscreen on macOS · Issue #5933 · defold/defold · GitHub

1 Like

There were two dmengine files in the .zip. This is from the x86_64-darwin folder:

Applications/Desktop game % ./dmengine
INFO:DLIB: Log server started on port 49358
INFO:ENGINE: Target listening with name: Bryans-MacBook-Pro.local - ::1 - Darwin
INFO:ENGINE: Engine service started on port 8001
INFO:ENGINE: Defold Engine 1.2.185 (ef87996)
2021-07-14 06:04:45.249 dmengine[696:7957] void * _Nullable NSMapGet(NSMapTable * _Nonnull, const void * _Nullable): map table argument is NULL
WARNING:GRAPHICS: Trying OpenGL 3.1 compat mode
Assertion failed: (extensions), function OpenGLOpenWindow, file …/src/opengl/graphics_opengl.cpp, line 911.
INFO:CRASH: Successfully wrote Crashdump to file: /Users/bryanrieger/Library/Application Support/Defold/_crash
ERROR:CRASH: CALL STACK:

#0 pc 0x91d7d libc++abi.dylib _sigtramp+29
zsh: abort ./dmengine

_crash.zip (2.1 KB)
report.txt (60.0 KB)

And this is from the dmengine file in the root dmengine_beta185_ogl_debug dir:

INFO:DLIB: Log server started on port 49435
INFO:ENGINE: Target listening with name: Bryans-MacBook-Pro.local - ::1 - Darwin
INFO:ENGINE: Engine service started on port 8001
INFO:ENGINE: Defold Engine 1.2.185 (ef87996)
INFO:ENGINE: Loading data from: build/default
INFO:ENGINE: Initialised sound device ‘default’
INFO:DLIB: SSDP: Started on address 10.0.0.63
INFO:DLIB: SSDP: Done on address 10.0.0.63

IT WORKS! :slight_smile:

3 Likes

Ah, yes I was a bit quick and accidentally bundled the old one as well.

IT WORKS!

Thanks for confirming!
The fix is now merged into the beta build and a new release will be available in ~45-50 minutes.

5 Likes