Problem with macOS bundle - bundle crush after load collection from proxy (DEF-2935) (SOLVED)

Hello all.

After release Defold 1.2.115 I rebundle my project. On Windows all work good, but on macOS bundle crush. Help please. If need additional info. Ask please

Below crushlog:
Process: Tidal shore [22405]
Path: /Volumes/VOLUME/*/Tidal shore.app/Contents/MacOS/Tidal shore
Identifier: example.unnamed
Version: 0.0.2.6 (1)
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: Tidal shore [22405]
User ID: 501

Date/Time: 2017-10-17 22:42:22.975 +0300
OS Version: Mac OS X 10.12.6 (16G29)
Report Version: 12
Anonymous UUID: 2E2AB5F4-6F92-09B3-5698-9B2DF0016B69

Sleep/Wake UUID: 3354F969-BF1D-49FF-A3CD-4EE3B47DB6AE

Time Awake Since Boot: 380000 seconds
Time Since Wake: 710 seconds

System Integrity Protection: enabled

Notes: Translocated Process

Crashed Thread: 0 Dispatch queue: com.apple.main-thread

Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY

Application Specific Information:
Assertion failed: (top == lua_gettop(L)), function RunScript, file …/src/render/render_script.cpp, line 2674.

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libsystem_kernel.dylib 0x00007fffb407ed42 __pthread_kill + 10
1 libsystem_pthread.dylib 0x00007fffb416c457 pthread_kill + 90
2 libsystem_c.dylib 0x00007fffb3fe4420 abort + 129
3 libsystem_c.dylib 0x00007fffb3fab893 __assert_rtn + 320
4 example.unnamed 0x0000000104a4cd2d dmRender::RunScript(dmRender::RenderScriptInstance*, dmRender::RenderScriptFunction, void*) + 349
5 example.unnamed 0x0000000104a4d0cc dmRender::UpdateRenderScriptInstance(dmRender::RenderScriptInstance*) + 156
6 example.unnamed 0x000000010495a503 dmEngine::Step(dmEngine::Engine*) + 1347
7 example.unnamed 0x00000001049b3356 dmGraphics::RunApplicationLoop(void*, void ()(void), int ()(void)) + 38
8 example.unnamed 0x000000010495b243 dmEngine::InitRun(dmEngineService::EngineService*, int, char**, void ()(dmEngine::Engine, void*), void ()(dmEngine::Engine, void*), void*) + 179
9 example.unnamed 0x000000010495b0c5 dmEngine::Launch(int, char**, void ()(dmEngine::Engine, void*), void ()(dmEngine::Engine, void*), void*) + 213
10 example.unnamed 0x000000010495b376 engine_main(int, char**) + 118
11 example.unnamed 0x00000001049537a4 start + 52

Thread 1:
0 libsystem_kernel.dylib 0x00007fffb407f44e __workq_kernreturn + 10
1 libsystem_pthread.dylib 0x00007fffb416948e _pthread_wqthread + 1023
2 libsystem_pthread.dylib 0x00007fffb416907d start_wqthread + 13

Thread 2:
0 libsystem_kernel.dylib 0x00007fffb407f44e __workq_kernreturn + 10
1 libsystem_pthread.dylib 0x00007fffb416948e _pthread_wqthread + 1023
2 libsystem_pthread.dylib 0x00007fffb416907d start_wqthread + 13

Thread 3:
0 libsystem_kernel.dylib 0x00007fffb407f44e __workq_kernreturn + 10
1 libsystem_pthread.dylib 0x00007fffb416948e _pthread_wqthread + 1023
2 libsystem_pthread.dylib 0x00007fffb416907d start_wqthread + 13

Thread 4:
0 libsystem_kernel.dylib 0x00007fffb407f44e __workq_kernreturn + 10
1 libsystem_pthread.dylib 0x00007fffb4169621 _pthread_wqthread + 1426
2 libsystem_pthread.dylib 0x00007fffb416907d start_wqthread + 13

Thread 5:: log
0 libsystem_kernel.dylib 0x00007fffb407ef46 __semwait_signal + 10
1 libsystem_c.dylib 0x00007fffb4005b72 nanosleep + 199
2 libsystem_c.dylib 0x00007fffb4005a66 usleep + 54
3 example.unnamed 0x0000000104b1e1fa dmLogThread(void*) + 250
4 example.unnamed 0x0000000104b304fc dmThread::ThreadStartProxy(void*) + 28
5 libsystem_pthread.dylib 0x00007fffb416993b _pthread_body + 180
6 libsystem_pthread.dylib 0x00007fffb4169887 _pthread_start + 286
7 libsystem_pthread.dylib 0x00007fffb416908d thread_start + 13

Thread 6:: CVDisplayLink
0

libsystem_kernel.dylib 0x00007fffb407ebf2 __psynch_cvwait + 10
1 libsystem_pthread.dylib 0x00007fffb416a833 _pthread_cond_wait + 769
2 com.apple.CoreVideo 0x00007fff9fe8c977 CVDisplayLink::waitUntil(unsigned long long) + 233
3 com.apple.CoreVideo 0x00007fff9fe8c762 CVDisplayLink::runIOThread() + 520
4 libsystem_pthread.dylib 0x00007fffb416993b _pthread_body + 180
5 libsystem_pthread.dylib 0x00007fffb4169887 _pthread_start + 286
6 libsystem_pthread.dylib 0x00007fffb416908d thread_start + 13

Thread 7:: graphicsworker
0 libsystem_platform.dylib 0x00007fffb4162ff6 _platform_memmove$VARIANT$Haswell + 342
1 com.apple.driver.AppleIntelBDWGraphicsGLDriver 0x0000000007d5bc73 glrUpdateTexture + 10886
2 libGPUSupportMercury.dylib 0x00007fffac4a5c98 gldModifyTexSubImage + 188
3 GLEngine 0x00000000076bfe21 glTexImage2D_Exec + 2097
4 libGL.dylib 0x00007fffa2c2846d glTexImage2D + 77
5 example.unnamed 0x00000001049b6a21 dmGraphics::SetTexture(dmGraphics::Texture*, dmGraphics::TextureParams const&) + 2673
6 example.unnamed 0x00000001049b7a9d dmGraphics::DoSetTextureAsync(void*) + 269
7 example.unnamed 0x00000001049b8ddc dmGraphics::AsyncThread(void*) + 188
8 example.unnamed 0x0000000104b304fc dmThread::ThreadStartProxy(void*) + 28
9 libsystem_pthread.dylib 0x00007fffb416993b _pthread_body + 180
10 libsystem_pthread.dylib 0x00007fffb4169887 _pthread_start + 286
11 libsystem_pthread.dylib 0x00007fffb416908d thread_start + 13

Thread 8:: http
0 libsystem_kernel.dylib 0x00007fffb407ebf2 __psynch_cvwait + 10
1 libsystem_pthread.dylib 0x00007fffb416a7fa _pthread_cond_wait + 712
2 example.unnamed 0x0000000104afabd9 dmConditionVariable::Wait(_opaque_pthread_cond_t*, _opaque_pthread_mutex_t*) + 9
3 example.unnamed 0x0000000104b20670 dmMessage::InternalDispatch(unsigned long long, void ()(dmMessage::Message, void*), void*, bool) + 336
4 example.unnamed 0x0000000104a4e48f dmHttpService::Loop(void*) + 63
5 example.unnamed 0x0000000104b304fc dmThread::ThreadStartProxy(void*) + 28
6 libsystem_pthread.dylib 0x00007fffb416993b _pthread_body + 180
7 libsystem_pthread.dylib 0x00007fffb4169887 _pthread_start + 286
8 libsystem_pthread.dylib 0x00007fffb416908d thread_start + 13

Thread 9:: http
0 libsystem_kernel.dylib 0x00007fffb407ebf2 __psynch_cvwait + 10
1 libsystem_pthread.dylib 0x00007fffb416a7fa _pthread_cond_wait + 712
2 example.unnamed 0x0000000104afabd9 dmConditionVariable::Wait(_opaque_pthread_cond_t*, _opaque_pthread_mutex_t*) + 9
3 example.unnamed 0x0000000104b20670 dmMessage::InternalDispatch(unsigned long long, void ()(dmMessage::Message, void*), void*, bool) + 336
4 example.unnamed 0x0000000104a4e48f dmHttpService::Loop(void*) + 63
5 example.unnamed 0x0000000104b304fc dmThread::ThreadStartProxy(void*) + 28
6 libsystem_pthread.dylib 0x00007fffb416993b _pthread_body + 180
7 libsystem_pthread.dylib 0x00007fffb4169887 _pthread_start + 286
8 libsystem_pthread.dylib 0x00007fffb416908d thread_start + 13

Thread 10:: http
0 libsystem_kernel.dylib 0x00007fffb407ebf2 __psynch_cvwait + 10
1 libsystem_pthread.dylib 0x00007fffb416a7fa _pthread_cond_wait + 712
2 example.unnamed 0x0000000104afabd9 dmConditionVariable::Wait(_opaque_pthread_cond_t*, _opaque_pthread_mutex_t*) + 9
3 example.unnamed 0x0000000104b20670 dmMessage::InternalDispatch(unsigned long long, void ()(dmMessage::Message, void*), void*, bool) + 336
4 example.unnamed 0x0000000104a4e48f dmHttpService::Loop(void*) + 63
5 example.unnamed 0x0000000104b304fc dmThread::ThreadStartProxy(void*) + 28
6 libsystem_pthread.dylib 0x00007fffb416993b _pthread_body + 180
7 libsystem_pthread.dylib 0x00007fffb4169887 _pthread_start + 286
8 libsystem_pthread.dylib 0x00007fffb416908d thread_start + 13

Thread 11:: http
0 libsystem_kernel.dylib 0x00007fffb407ebf2 __psynch_cvwait + 10
1 libsystem_pthread.dylib 0x00007fffb416a7fa _pthread_cond_wait + 712
2 example.unnamed 0x0000000104afabd9 dmConditionVariable::Wait(_opaque_pthread_cond_t*, _opaque_pthread_mutex_t*) + 9
3 example.unnamed 0x0000000104b20670 dmMessage::InternalDispatch(unsigned long long, void ()(dmMessage::Message, void*), void*, bool) + 336
4 example.unnamed 0x0000000104a4e48f dmHttpService::Loop(void*) + 63
5 example.unnamed 0x0000000104b304fc dmThread::ThreadStartProxy(void*) + 28
6 libsystem_pthread.dylib 0x00007fffb416993b _pthread_body + 180
7 libsystem_pthread.dylib 0x00007fffb4169887 _pthread_start + 286
8 libsystem_pthread.dylib 0x00007fffb416908d thread_start + 13

Thread 12:: http_balance
0 libsystem_kernel.dylib 0x00007fffb407ebf2 __psynch_cvwait + 10
1 libsystem_pthread.dylib 0x00007fffb416a7fa _pthread_cond_wait + 712
2 example.unnamed 0x0000000104afabd9 dmConditionVariable::Wait(_opaque_pthread_cond_t*, _opaque_pthread_mutex_t*) + 9
3 example.unnamed 0x0000000104b20670 dmMessage::InternalDispatch(unsigned long long, void ()(dmMessage::Message, void*), void*, bool) + 336
4 example.unnamed 0x0000000104a4e9ff dmHttpService::LoadBalancer(void*) + 47
5 example.unnamed 0x0000000104b304fc dmThread::ThreadStartProxy(void*) + 28
6 libsystem_pthread.dylib 0x00007fffb416993b _pthread_body + 180
7 libsystem_pthread.dylib 0x00007fffb4169

Is that Editor 1? Try Editor 2.

It not Editor - it standalone bundle.

PS: I use Editor 2

Are you using any extensions?

Yes, but I try bundle without extension and receive same error.

What you’ve stumbled upon is a bug in our render script code.
The standard functions aren’t supposed to return any values, and if they do, we will assert.
Check your ìnit, update and on_message functions and see if they return a value.

I added this as ticket DEF-2934

2 Likes

Thank you for answer.

You mean check init, update and on_message for call return function?

yes

If you return anything in any of those functions it will trigger a bug in the engine.

Mathias is fixing this on our end now and it will probably be fixed in the next release, but until then; remove any return statements you have in the built-in functions such as init, update, on_message etc.

1 Like

I check all *.*script files and not found call return in init, on_message and update function. Only in my *.lua modules

Hmm. Would you mind posting your .render_script you are using?

function init(self)
    self.tile_pred = render.predicate({"tile"})
    self.gui_pred = render.predicate({"gui"})
    self.text_pred = render.predicate({"text"})
    self.particle_pred = render.predicate({"particle"})
    self.cursor_pred = render.predicate({"cursor"})

    self.clear_color = vmath.vector4(0, 0, 0, 0)
    self.clear_color.x = sys.get_config("render.clear_color_red", 0)
    self.clear_color.y = sys.get_config("render.clear_color_green", 0)
    self.clear_color.z = sys.get_config("render.clear_color_blue", 0)
    self.clear_color.w = sys.get_config("render.clear_color_alpha", 0)

    self.view = vmath.matrix4()
end

function update(self)
    render.set_depth_mask(true)
    render.set_stencil_mask(0xff)
    render.clear({[render.BUFFER_COLOR_BIT] = self.clear_color, [render.BUFFER_DEPTH_BIT] = 1, [render.BUFFER_STENCIL_BIT] = 0})

    render.set_viewport(0, 0, render.get_window_width(), render.get_window_height())
    render.set_view(self.view)

    render.set_depth_mask(false)
    render.disable_state(render.STATE_DEPTH_TEST)
    render.disable_state(render.STATE_STENCIL_TEST)
    render.enable_state(render.STATE_BLEND)
    render.set_blend_func(render.BLEND_SRC_ALPHA, render.BLEND_ONE_MINUS_SRC_ALPHA)
    render.disable_state(render.STATE_CULL_FACE)

    render.set_projection(vmath.matrix4_orthographic(0, render.get_width(), 0, render.get_height(), -1, 1))

    render.draw(self.tile_pred)
    render.draw(self.particle_pred)
    render.draw_debug3d()

    render.set_view(vmath.matrix4())
    render.set_projection(vmath.matrix4_orthographic(0, render.get_window_width(), 0, render.get_window_height(), -1, 1))

    render.enable_state(render.STATE_STENCIL_TEST)
    render.draw(self.gui_pred)
    render.draw(self.text_pred)
    --render.draw(self.cursor_pred)    
    render.disable_state(render.STATE_STENCIL_TEST)

    render.set_depth_mask(false)
    render.draw_debug2d()

    render.set_projection(vmath.matrix4_orthographic(0, render.get_width(), 0, render.get_height(), -1, 1))

    render.draw(self.cursor_pred)    
    render.draw_debug3d()
end

function on_message(self, message_id, message)
    if message_id == hash("clear_color") then
        self.clear_color = message.color
    elseif message_id == hash("set_view_projection") then
        self.view = message.view
    end
end

Some return present in extension scripts, but they place in *.lua modules and *.cpp modules

If needed I can try make build with standart render script.

One return in *.script file present in this function, but i dont think it have problem.

function round(number, div)	
	local number = number or 0
	if div >= 5 then
		number = math.ceil(number)
	elseif	div < 5 then
		number = math.floor(number)
	end
	return number	
end

Ok. It might be your extension after all. How did you disable it?

As for your C++ code, you should use the DM_LUA_STACK_CHECK macro to make sure your functions doesn’t leave anything unwanted on the stack.

Btw, did you use your extension in the render script?

1 Like

I not created my extensions. I use only from Community Asserts.

List of extensions which I use:
defcon
defnet
defos
timer
openal

And it not used in render script. I try dmengine from defold editor jar file - from _unpack folder for test. I can try disable dependicies in game.project file and delete openal folder if need

Hmm, this is tricky to solve without testing the project. Would you mind inviting me to your project? (mathias.westerdahl AT king.com)
And don’t forget to synchronize the project :slight_smile:

I’ve fixed the DEF-2934 (which wasn’t the root cause), and logged the new ticket DEF-2935.
In short, the collection proxy loads all textures into memory at the same time, then tries to upload them to the GPU one by one. But, since the textures are so large, it affects Lua (since it stores memory offsets in an int32).

We’re working on a fix, but in the meantime, there are a few workarounds:

  • Put assets in multiple collection proxies, and load them one after another
  • Use a .texture_profiles file, and specify some maximum texture size.
5 Likes

Thank you for help.