[0.18.12] Malloc - incorrect checksum

Place for things which are bugs but we have no idea how to solve them. Things related to hardware, libraries, strange setups, etc.
Post Reply
Uthrom
Inserter
Inserter
Posts: 33
Joined: Fri Jan 11, 2019 4:01 pm
Contact:

[0.18.12] Malloc - incorrect checksum

Post by Uthrom »

Idling on the MP game boskid was debugging earlier, gave the following:

Code: Select all

factorio(55761,0x700007d47000) malloc: *** error for object 0x7fa9a176e0b8: incorrect checksum for freed object - object was probably modified after being freed.
*** set a breakpoint in malloc_error_break to debug
Attaching with lldb gives the following:

Code: Select all

Process 55761 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
    frame #0: 0x00007fff8b5fbbf2 libsystem_kernel.dylib`__psynch_cvwait + 10
libsystem_kernel.dylib`__psynch_cvwait:
->  0x7fff8b5fbbf2 <+10>: jae    0x7fff8b5fbbfc            ; <+20>
    0x7fff8b5fbbf4 <+12>: movq   %rax, %rdi
    0x7fff8b5fbbf7 <+15>: jmp    0x7fff8b5f4caf            ; cerror_nocancel
    0x7fff8b5fbbfc <+20>: retq   
  thread #14, name = 'GameUpdate', stop reason = EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)
    frame #0: 0x00007fff8b6dfae4 libsystem_platform.dylib`_os_unfair_lock_recursive_abort + 23
libsystem_platform.dylib`_os_unfair_lock_recursive_abort:
->  0x7fff8b6dfae4 <+23>: ud2    

libsystem_platform.dylib`_os_ulock_wait:
    0x7fff8b6dfae6 <+0>:  pushq  %rbp
    0x7fff8b6dfae7 <+1>:  movq   %rsp, %rbp
    0x7fff8b6dfaea <+4>:  pushq  %r15
Target 0: (factorio) stopped.

Executable module set to "/Applications/factorio.app/Contents/MacOS/factorio".
Architecture set to: x86_64h-apple-macosx.
(lldb) thread list

Code: Select all

Process 55761 stopped
* thread #1: tid = 0x777327, 0x00007fff8b5fbbf2 libsystem_kernel.dylib`__psynch_cvwait + 10, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
  thread #2: tid = 0x77736d, 0x00007fff8b5fbbf2 libsystem_kernel.dylib`__psynch_cvwait + 10, name = 'TaskManager'
  thread #3: tid = 0x777371, 0x00007fff8b5fbbf2 libsystem_kernel.dylib`__psynch_cvwait + 10, name = 'WorkerThread'
  thread #4: tid = 0x777372, 0x00007fff8b5fbbf2 libsystem_kernel.dylib`__psynch_cvwait + 10, name = 'WorkerThread'
  thread #5: tid = 0x777373, 0x00007fff8b5fbbf2 libsystem_kernel.dylib`__psynch_cvwait + 10, name = 'WorkerThread'
  thread #6: tid = 0x777374, 0x00007fff8b5fbbf2 libsystem_kernel.dylib`__psynch_cvwait + 10, name = 'WorkerThread'
  thread #7: tid = 0x777375, 0x00007fff8b5fbbf2 libsystem_kernel.dylib`__psynch_cvwait + 10, name = 'WorkerThread'
  thread #8: tid = 0x777376, 0x00007fff8b5fbbf2 libsystem_kernel.dylib`__psynch_cvwait + 10, name = 'WorkerThread'
  thread #9: tid = 0x777377, 0x00007fff8b5fbbf2 libsystem_kernel.dylib`__psynch_cvwait + 10, name = 'WorkerThread'
  thread #10: tid = 0x777378, 0x00007fff8b5fbbf2 libsystem_kernel.dylib`__psynch_cvwait + 10, name = 'SDLTimer'
  thread #11: tid = 0x7773ac, 0x00007fff8b5fc31e libsystem_kernel.dylib`__ulock_wait + 10, name = 'com.apple.NSEventThread'
  thread #12: tid = 0x7773d9, 0x00007fff8b5fc31e libsystem_kernel.dylib`__ulock_wait + 10, name = 'com.apple.audio.IOThread.client'
  thread #13: tid = 0x7773db, 0x00007fff8b5fbf46 libsystem_kernel.dylib`__semwait_signal + 10
  thread #14: tid = 0x7777ab, 0x00007fff8b6dfae4 libsystem_platform.dylib`_os_unfair_lock_recursive_abort + 23, name = 'GameUpdate', stop reason = EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)
  thread #15: tid = 0x778025, 0x00007fff8b5fc31e libsystem_kernel.dylib`__ulock_wait + 10, name = 'RouterBase::readPacketsLoop'
  thread #16: tid = 0x778052, 0x00007fff8b5fbbf2 libsystem_kernel.dylib`__psynch_cvwait + 10, name = 'WorkerThread'
  thread #17: tid = 0x778053, 0x00007fff8b5fbbf2 libsystem_kernel.dylib`__psynch_cvwait + 10, name = 'WorkerThread'
  thread #18: tid = 0x778054, 0x00007fff8b5fbbf2 libsystem_kernel.dylib`__psynch_cvwait + 10, name = 'WorkerThread'
  thread #19: tid = 0x778055, 0x00007fff8b5fbbf2 libsystem_kernel.dylib`__psynch_cvwait + 10, name = 'WorkerThread'
  thread #20: tid = 0x778056, 0x00007fff8b5fbbf2 libsystem_kernel.dylib`__psynch_cvwait + 10, name = 'WorkerThread'
  thread #21: tid = 0x778057, 0x00007fff8b5fbbf2 libsystem_kernel.dylib`__psynch_cvwait + 10, name = 'WorkerThread'
  thread #22: tid = 0x778058, 0x00007fff8b5fbbf2 libsystem_kernel.dylib`__psynch_cvwait + 10, name = 'WorkerThread'
  thread #23: tid = 0x778059, 0x00007fff8b5fbbf2 libsystem_kernel.dylib`__psynch_cvwait + 10, name = 'WorkerThread'
  thread #24: tid = 0x778064, 0x00007fff8b5fbbf2 libsystem_kernel.dylib`__psynch_cvwait + 10, name = 'MapGenerationHelper'
  thread #25: tid = 0x77949f, 0x00007fff8b5fc31e libsystem_kernel.dylib`__ulock_wait + 10
  thread #26: tid = 0x77a1fb, 0x00007fff8b5fc44e libsystem_kernel.dylib`__workq_kernreturn + 10
(lldb) thread select 14

Code: Select all

* thread #14, name = 'GameUpdate', stop reason = EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)
    frame #0: 0x00007fff8b6dfae4 libsystem_platform.dylib`_os_unfair_lock_recursive_abort + 23
libsystem_platform.dylib`_os_unfair_lock_recursive_abort:
->  0x7fff8b6dfae4 <+23>: ud2    

libsystem_platform.dylib`_os_ulock_wait:
    0x7fff8b6dfae6 <+0>:  pushq  %rbp
    0x7fff8b6dfae7 <+1>:  movq   %rsp, %rbp
    0x7fff8b6dfaea <+4>:  pushq  %r15
(lldb) thread backtrace

Code: Select all

* thread #14, name = 'GameUpdate', stop reason = EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)
  * frame #0: 0x00007fff8b6dfae4 libsystem_platform.dylib`_os_unfair_lock_recursive_abort + 23
    frame #1: 0x00007fff8b6df405 libsystem_platform.dylib`_os_unfair_lock_lock_slow + 181
    frame #2: 0x00007fff8b64f42d libsystem_malloc.dylib`szone_malloc_should_clear + 179
    frame #3: 0x00007fff8b64f31a libsystem_malloc.dylib`malloc_zone_malloc + 107
    frame #4: 0x00007fff8b64e310 libsystem_malloc.dylib`malloc + 24
    frame #5: 0x00007fff8a06ba80 libc++abi.dylib`std::__1::basic_string<char, std::__1::char_traits<char>, __cxxabiv1::(anonymous namespace)::malloc_alloc<char> >::__grow_by_and_replace(unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, char const*) + 124
    frame #6: 0x00007fff8a06bb7f libc++abi.dylib`std::__1::basic_string<char, std::__1::char_traits<char>, __cxxabiv1::(anonymous namespace)::malloc_alloc<char> >::append(char const*, unsigned long) + 113
    frame #7: 0x00007fff8a0630c5 libc++abi.dylib`char const* __cxxabiv1::(anonymous namespace)::parse_encoding<__cxxabiv1::(anonymous namespace)::Db>(char const*, char const*, __cxxabiv1::(anonymous namespace)::Db&) + 2848
    frame #8: 0x00007fff8a061e8a libc++abi.dylib`void __cxxabiv1::(anonymous namespace)::demangle<__cxxabiv1::(anonymous namespace)::Db>(char const*, char const*, __cxxabiv1::(anonymous namespace)::Db&, int&) + 109
    frame #9: 0x00007fff8a061bd9 libc++abi.dylib`__cxa_demangle + 505
    frame #10: 0x00000001011eba1f factorio`::writeStacktrace() at Logger.cpp:419 [opt]
    frame #11: 0x00000001011ebbc2 factorio`::logStacktrace() at Logger.cpp:546 [opt]
    frame #12: 0x0000000100838539 factorio`::writeStackTrace() at MapDeserialiser.cpp:183 [opt]
    frame #13: 0x00000001011cfee4 factorio`::commonSignalHandler() at MapDeserialiser.cpp:620 [opt]
    frame #14: 0x00000001011cf3d9 factorio`::SignalHandler() at MapDeserialiser.cpp:626 [opt]
    frame #15: 0x00007fff8b6dcb3a libsystem_platform.dylib`_sigtramp + 26
    frame #16: 0x00007fff8b5fbd43 libsystem_kernel.dylib`__pthread_kill + 11
    frame #17: 0x00007fff8b6e9457 libsystem_pthread.dylib`pthread_kill + 90
    frame #18: 0x00007fff8b561420 libsystem_c.dylib`abort + 129
    frame #19: 0x00007fff8b65bff5 libsystem_malloc.dylib`szone_error + 626
    frame #20: 0x00007fff8b650c84 libsystem_malloc.dylib`tiny_malloc_from_free_list + 1148
    frame #21: 0x00007fff8b64f50a libsystem_malloc.dylib`szone_malloc_should_clear + 400
    frame #22: 0x00007fff8b64f31a libsystem_malloc.dylib`malloc_zone_malloc + 107
    frame #23: 0x00007fff8b652039 libsystem_malloc.dylib`realloc + 145
    frame #24: 0x000000010180d451 factorio`::luaM_realloc_() at lmem.c:84 [opt]
    frame #25: 0x00000001018079dd factorio`::luaC_newobj() at lgc.c:224 [opt]
    frame #26: 0x0000000101815d38 factorio`::luaH_new() at ltable.c:380 [opt]
    frame #27: 0x00000001017fb112 factorio`::lua_createtable() at lapi.c:737 [opt]
    frame #28: 0x000000010164b250 factorio`::registerObject() at TextField.hpp:49 [opt]
    frame #29: 0x0000000101134f7d factorio`::initLuaState() [inlined] initLuaStateInternal<LuaTile> at MouseButton.hpp:85 [opt]
    frame #30: 0x0000000101134f6d factorio`::initLuaState() at LuaTile.cpp:111 [opt]
    frame #31: 0x000000010111b53e factorio`::luaFindTilesFiltered() [inlined] LuaTile at EntityWithForce.hpp:46 [opt]
    frame #32: 0x000000010111b4db factorio`::luaFindTilesFiltered() [inlined] LuaTile at LuaTile.cpp:43 [opt]
    frame #33: 0x000000010111b4db factorio`::luaFindTilesFiltered() at LuaSurface.cpp:1089 [opt]
    frame #34: 0x0000000101643b67 factorio`::callWrapper() at TextField.hpp:327 [opt]
    frame #35: 0x00000001018062b6 factorio`::luaD_precall() at ldo.c:348 [opt]
    frame #36: 0x000000010181ac48 factorio`::luaV_execute() at lvm.c:710 [opt]
    frame #37: 0x0000000101805ce6 factorio`::luaD_call() at ldo.c:424 [opt]
    frame #38: 0x0000000101805a64 factorio`::luaD_rawrunprotected() at ldo.c:137 [opt]
    frame #39: 0x000000010180674d factorio`::luaD_pcall() at ldo.c:623 [opt]
    frame #40: 0x00000001017fbecd factorio`::lua_pcallk() at lapi.c:1053 [opt]
    frame #41: 0x0000000101014fdd factorio`::runEventHandler() [inlined] pCallWithStackTrace at LuaHelper.cpp:3892 [opt]
    frame #42: 0x0000000101014fa0 factorio`::runEventHandler() [inlined] signallingPCall at LuaGameScript.cpp:6857 [opt]
    frame #43: 0x0000000101014f92 factorio`::runEventHandler() at LuaGameScript.cpp:1017 [opt]
    frame #44: 0x000000010100b2af factorio`::run() at GuiDirection.cpp:570 [opt]
    frame #45: 0x00000001007797cc factorio`::selectArea() [inlined] sendToListeners at GameActionDispatcher.cpp:14 [opt]
    frame #46: 0x00000001007797aa factorio`::selectArea() at GameActionHandler.cpp:2985 [opt]
    frame #47: 0x000000010075efed factorio`::actionPerformed() at Entity.cpp:334 [opt]
    frame #48: 0x0000000100ca7c8c factorio`::flushActions() [inlined] flushToListeners at InputHandler.cpp:72 [opt]
    frame #49: 0x0000000100ca7c6b factorio`::flushActions() at InputHandler.cpp:64 [opt]
    frame #50: 0x0000000100e84b48 factorio`::flushActions() at NetworkInputHandler.cpp:179 [opt]
    frame #51: 0x0000000100e844f4 factorio`::tryToApplyNextTickClosure() at NetworkInputHandler.cpp:119 [opt]
    frame #52: 0x0000000100e64f89 factorio at ClientMultiplayerManager.cpp:493 [opt]
    frame #53: 0x0000000100e64f24 factorio at ClientMultiplayerManager.cpp:0 [opt]
    frame #54: 0x0000000100d77ed3 factorio`::updateMultiplayerInput() at MultiplayerManagerBase.cpp:174 [opt]
    frame #55: 0x0000000100d73336 factorio`::gameUpdateStep() at MainLoop.cpp:1152 [opt]
    frame #56: 0x0000000100d7102e factorio`::gameUpdateLoop() at MainLoop.cpp:1036 [opt]
    frame #57: 0x000000010121a1d4 factorio`::loop() [inlined] operator() at functional:1913 [opt]
    frame #58: 0x000000010121a1ce factorio`::loop() at WorkerThread.cpp:48 [opt]
    frame #59: 0x000000010168ceae factorio`::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void (WorkerThread::*)(), WorkerThread *> >() [inlined] __invoke<void (WorkerThread::*)(), WorkerThread *, void> at type_traits:4286 [opt]
    frame #60: 0x000000010168ce94 factorio`::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void (WorkerThread::*)(), WorkerThread *> >() [inlined] __thread_execute<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void (WorkerThread::*)(), WorkerThread *, 2> at thread:342 [opt]
    frame #61: 0x000000010168ce94 factorio`::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void (WorkerThread::*)(), WorkerThread *> >() at thread:352 [opt]
    frame #62: 0x00007fff8b6e693b libsystem_pthread.dylib`_pthread_body + 180
    frame #63: 0x00007fff8b6e6887 libsystem_pthread.dylib`_pthread_start + 286
    frame #64: 0x00007fff8b6e608d libsystem_pthread.dylib`thread_start + 13
(lldb) 
I've turned on core dumps from now on out, so I should be able to provide a core dump from here on out.

Save and mods: http://bit.ly/3cZJI4V

Rseding91
Factorio Staff
Factorio Staff
Posts: 13209
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [0.18.12] Malloc - incorrect checksum

Post by Rseding91 »

Thanks for the report however I fear you're probably doomed.

I've seen these crashes multiple times and they're always from MacOS users and always in the Lua internals allocating some memory/reallocating it. Nobody has any reliable steps to reproduce it and nobody has had it not on MacOS.

Until someone is able to reliably reproduce it I'm inclined to think it's some MacOS bug at this point.
If you want to get ahold of me I'm almost always on Discord.

Post Reply

Return to “1 / 0 magic”