GRPC Server LogMessage Unmarshalling Busto

Reporter: RobertBColton  |  Status: open  |  Last Modified: March 08, 2020, 02:21:46 AM

Figured out what's the deal with RGM only wanting to compile a game a single time. It's because after you close the game, emake is crashing. Emake is crashing because of the crappy code I wrote to unmarshal the redirect output file into structured LogMessages.
while (future.wait_for(std::chrono::seconds(0)) != std::future_status::ready) {

const LogMessage CallBack::GetFirstLogMessage(bool &end) const {

We can see this by adding a MessageBox blocking call to the future right after its call to compile returns. What happens then is you'll still be able to compile again in RGM side instead of emake crashing. If we instead put a MessageBox at the bottom of the LogMessage loop, the output will get stuck waiting on the blocking MessageBox while the game opens. Closing the game without dismissing the MessageBox crashes emake (verify in task manager).

RobertBColton  
Got a stack trace by building emake with debug symbols and running it in GDB.

Game returned 0

Thread 13 received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1184.0x308]
0x00000000016695de in buffers::CompileRequest::SharedDtor (this=0x15df730)
    at .eobjs/compiler.pb.cc:1218
1218      if (this != internal_default_instance()) delete game_;
(gdb) bt
#0  0x00000000016695de in buffers::CompileRequest::SharedDtor (this=0x15df730)
    at .eobjs/compiler.pb.cc:1218
#1  0x0000000001612433 in buffers::CompileRequest::~CompileRequest (
    this=0x15df730, __in_chrg=<optimized out>) at .eobjs/compiler.pb.cc:1213
#2  0x00000000004590f0 in CompilerServiceImpl::CompileBuffer(grpc_impl::ServerContext*, buffers::CompileRequest const*, grpc_impl::ServerWriter<buffers::CompileReply>*)::{lambda()#1}::operator()() const (__closure=0x75c2d38)
    at Server.cpp:31
#3  0x0000000000453150 in std::__invoke_impl<void, CompilerServiceImpl::CompileBuffer(grpc_impl::ServerContext*, buffers::CompileRequest const*, grpc_impl::ServerWriter<buffers::CompileReply>*)::{lambda()#1}>(std::__invoke_other, CompilerServiceImpl::CompileBuffer(grpc_impl::ServerContext*, buffers::CompileRequest const*, grpc_impl::ServerWriter<buffers::CompileReply>*)::{lambda()#1}&&) (
    __f=...) at C:/msys64/mingw64/include/c++/9.2.0/bits/invoke.h:60
#4  0x0000000000457c45 in std::__invoke<CompilerServiceImpl::CompileBuffer(grpc_impl::ServerContext*, buffers::CompileRequest const*, grpc_impl::ServerWriter<buffers::CompileReply>*)::{lambda()#1}>(std::__invoke_result&&, (CompilerServiceImpl::CompileBuffer(grpc_impl::ServerContext*, buffers::CompileRequest const*, grpc_impl::ServerWriter<buffers::CompileReply>*)::{lambda()#1}&&)...) (
    __fn=...) at C:/msys64/mingw64/include/c++/9.2.0/bits/invoke.h:95
#5  0x000000000044244b in std::thread::_Invoker<std::tuple<CompilerServiceImpl::CompileBuffer(grpc_impl::ServerContext*, buffers::CompileRequest const*, grpc_impl::ServerWriter<buffers::CompileReply>*)::{lambda()#1}> >::_M_invoke<0ull>(std::_Index_tuple<0ull>) (this=0x75c2d38)
    at C:/msys64/mingw64/include/c++/9.2.0/thread:244
#6  0x00000000004424a7 in std::thread::_Invoker<std::tuple<CompilerServiceImpl::CompileBuffer(grpc_impl::ServerContext*, buffers::CompileRequest const*, grpc_impl::ServerWriter<buffers::CompileReply>*)::{lambda()#1}> >::operator()() (
    this=0x75c2d38) at C:/msys64/mingw64/include/c++/9.2.0/thread:251
#7  0x000000000042f816 in std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<void>, std::__future_base::_Result_base::_Deleter>, std::thread::_Invoker<std::tuple<CompilerServiceImpl::CompileBuffer(grpc_impl::ServerContext*, buffers::CompileRequest const*, grpc_impl::ServerWriter<buffers::CompileReply>*)::{lambda()#1}> >, void>::operator()() const (this=0x15dfcc0)
    at C:/msys64/mingw64/include/c++/9.2.0/future:1362
#8  0x000000000043d8bb in std::_Function_handler<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> (), std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<void>, std::__future_base::_Result_base::_Deleter>, std::thread::_Invoker<std::tuple<CompilerServiceImpl::CompileBuffer(grpc_impl::ServerContext*, buffers::CompileRequest const*, grpc_impl::ServerWriter<buffers::CompileReply>*)::{lambda()#1}> >, void> >::_M_invoke(std::_Any_data const&) (__functor=...)
    at C:/msys64/mingw64/include/c++/9.2.0/bits/std_function.h:286
#9  0x00000000004321bb in std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>::operator()() const
    (this=0x15dfcc0)
    at C:/msys64/mingw64/include/c++/9.2.0/bits/std_function.h:690
#10 0x0000000000438934 in std::__future_base::_State_baseV2::_M_do_set(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*) (this=0x75c2cf0, __f=0x15dfcc0,
    __did_set=0x15dfc37) at C:/msys64/mingw64/include/c++/9.2.0/future:561
#11 0x00000000004530aa in std::__invoke_impl<void, void (std::__future_base::_State_baseV2::*)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*>(std::__invoke_memfun_deref, void (std::__future_base::_State_baseV2::*&&)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*&&, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*&&, bool*&&) (__f=
    @0x15dfc50: (void (std::__future_base::_State_baseV2::*)(std::__future_base::_State_baseV2 * const, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter>()> *, bool *)) 0x438910 <std::__future_base::_State_baseV2::_M_do_set(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*)>, __t=@0x15dfc48: 0x75c2cf0, __args#0=@0x15dfc40: 0x15dfcc0,
    __args#1=@0x15dfc38: 0x15dfc37)
    at C:/msys64/mingw64/include/c++/9.2.0/bits/invoke.h:73
#12 0x0000000000457b69 in std::__invoke<void (std::__future_base::_State_baseV2::*)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*>(void (std::__future_base::_State_baseV2::*&&)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*&&, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*&&, bool*&&) (__fn=
    @0x15dfc50: (void (std::__future_base::_State_baseV2::*)(std::__future_base::_State_baseV2 * const, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter>()> *, bool *)) 0x438910 <std::__future_base::_State_baseV2::_M_do_set(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*)>, __args#0=@0x15dfc48: 0x75c2cf0, __args#1=@0x15dfc40: 0x15dfcc0,
    __args#2=@0x15dfc38: 0x15dfc37)
    at C:/msys64/mingw64/include/c++/9.2.0/bits/invoke.h:95
#13 0x000000000045935d in std::call_once<void (std::__future_base::_State_baseV2::*)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*>(std::once_flag&, void (std::__future_base::_State_baseV2::*&&)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*&&, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*&&, bool*&&)::{lambda()#1}::operator()() const (this=0x15dfba0)
    at C:/msys64/mingw64/include/c++/9.2.0/mutex:671
#14 0x00000000004592c3 in std::call_once<void (std::__future_base::_State_baseV2::*)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*>(std::once_flag&, void (std::__future_base::_State_baseV2::*&&)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*&&, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*&&, bool*&&)::{lambda()#2}::operator()() const (this=0x0)
    at C:/msys64/mingw64/include/c++/9.2.0/mutex:676
#15 0x0000000000459382 in std::call_once<void (std::__future_base::_State_baseV2::*)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*>(std::once_flag&, void (std::__future_base::_State_baseV2::*&&)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*&&, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*&&, bool*&&)::{lambda()#2}::_FUN() () at C:/msys64/mingw64/include/c++/9.2.0/mutex:676
#16 0x0000000064945397 in pthread_once ()
   from C:\msys64\mingw64\bin\libwinpthread-1.dll
#17 0x000000000040cc83 in __gthread_once (__once=0x75c2d1c,
    __func=0x413e18 <__once_proxy>)
    at C:/msys64/mingw64/include/c++/9.2.0/x86_64-w64-mingw32/bits/gthr-default.h:700
#18 0x0000000000457d8d in std::call_once<void (std::__future_base::_State_baseV2::*)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*>(std::once_flag&, void (std::__future_base::_State_baseV2::*&&)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*&&, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*&&, bool*&&) (__once=..., __f=
    @0x15dfc50: (void (std::__future_base::_State_baseV2::*)(std::__future_base::_State_baseV2 * const, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter>()> *, bool *)) 0x438910 <std::__future_base::_State_baseV2::_M_do_set(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*)>, __args#0=@0x15dfc48: 0x75c2cf0, __args#1=@0x15dfc40: 0x15dfcc0,
    __args#2=@0x15dfc38: 0x15dfc37)
    at C:/msys64/mingw64/include/c++/9.2.0/mutex:683
#19 0x00000000004385c0 in std::__future_base::_State_baseV2::_M_set_result(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>, bool) (this=0x75c2cf0, __res=...,
    __ignore_failure=false) at C:/msys64/mingw64/include/c++/9.2.0/future:401
#20 0x0000000000459192 in std::__future_base::_Async_state_impl<std::thread::_Invoker<std::tuple<CompilerServiceImpl::CompileBuffer(grpc_impl::ServerContext*, buffers::CompileRequest const*, grpc_impl::ServerWriter<buffers::CompileReply>*)::{lambda()#1}> >, void>::_Async_state_impl(std::tuple<CompilerServiceImpl::CompileBuffer(grpc_impl::ServerContext*, buffers::CompileRequest const*, grpc_impl::ServerWriter<buffers::CompileReply>*)::{lambda()#1}>&&)::{lambda()#1}::operator()() const (this=0x75c2cf0)
    at C:/msys64/mingw64/include/c++/9.2.0/future:1662
#21 0x0000000000453180 in std::__invoke_impl<void, std::__future_base::_Async_state_impl<std::thread::_Invoker<std::tuple<CompilerServiceImpl::CompileBuffer(grpc_impl::ServerContext*, buffers::CompileRequest const*, grpc_impl::ServerWriter<buffers::CompileReply>*)::{lambda()#1}> >, void>::_Async_state_impl(std::tuple<CompilerServiceImpl::CompileBuffer(grpc_impl::ServerContext*, buffers::CompileRequest const*, grpc_impl::ServerWriter<buffers::CompileReply>*)::{lambda()#1}>&&)::{lambda()#1}>(std::__invoke_other, std::__future_base::_Async_state_impl<std::thread::_Invoker<std::tuple<CompilerServiceImpl::CompileBuffer(grpc_impl::ServerContext*, buffers::CompileRequest const*, grpc_impl::ServerWriter<buffers::CompileReply>*)::{lambda()#1}> >, void>::_Async_state_impl(std::tuple<CompilerServiceImpl::CompileBuffer(grpc_impl::ServerContext*, buffers::CompileRequest const*, grpc_impl::ServerWriter<buffers::CompileReply>*)::{lambda()#1}>&&)::{lambda()#1}&&) (__f=...)
    at C:/msys64/mingw64/include/c++/9.2.0/bits/invoke.h:60
#22 0x0000000000457c75 in std::__invoke<std::__future_base::_Async_state_impl<std::thread::_Invoker<std::tuple<CompilerServiceImpl::CompileBuffer(grpc_impl::ServerContext*, buffers::CompileRequest const*, grpc_impl::ServerWriter<buffers::CompileReply>*)::{lambda()#1}> >, void>::_Async_state_impl(std::tuple<CompilerServiceImpl::CompileBuffer(grpc_impl::ServerContext*, buffers::CompileRequest const*, grpc_impl::ServerWriter<buffers::CompileReply>*)::{lambda()#1}>&&)::{lambda()#1}>(std::__future_base::_Async_state_impl<std::thread::_Invoker<std::tuple<CompilerServiceImpl::CompileBuffer(grpc_impl::ServerContext*, buffers::CompileRequest const*, grpc_impl::ServerWriter<buffers::CompileReply>*)::{lambda()#1}> >, void>::_Async_state_impl(std::tuple<CompilerServiceImpl::CompileBuffer(grpc_impl::ServerContext*, buffers::CompileRequest const*, grpc_impl::ServerWriter<buffers::CompileReply>*)::{lambda()#1}>&&)::{lambda()#1}&&, (std::__invoke_result&&)...) (__fn=...) at C:/msys64/mingw64/include/c++/9.2.0/bits/invoke.h:95
#23 0x00000000004424db in std::thread::_Invoker<std::tuple<std::__future_base::_Async_state_impl<std::thread::_Invoker<std::tuple<CompilerServiceImpl::CompileBuffer(grpc_impl::ServerContext*, buffers::CompileRequest const*, grpc_impl::ServerWriter<buffers::CompileReply>*)::{lambda()#1}> >, void>::_Async_state_impl(std::tuple<CompilerServiceImpl::CompileBuffer(grpc_impl::ServerContext*, buffers::CompileRequest const*, grpc_impl::ServerWriter<buffers::CompileReply>*)::{lambda()#1}>&&)::{lambda()#1}> >::_M_invoke<0ull>(std::_Index_tuple<0ull>) (
    this=0x75c2d88) at C:/msys64/mingw64/include/c++/9.2.0/thread:244
#24 0x0000000000442537 in std::thread::_Invoker<std::tuple<std::__future_base::_Async_state_impl<std::thread::_Invoker<std::tuple<CompilerServiceImpl::CompileBuffer(grpc_impl::ServerContext*, buffers::CompileRequest const*, grpc_impl::ServerWriter<buffers::CompileReply>*)::{lambda()#1}> >, void>::_Async_state_impl(std::tuple<CompilerServiceImpl::CompileBuffer(grpc_impl::ServerContext*, buffers::CompileRequest const*, grpc_impl::ServerWriter<buffers::CompileReply>*)::{lambda()#1}>&&)::{lambda()#1}> >::operator()() (this=0x75c2d88)
    at C:/msys64/mingw64/include/c++/9.2.0/thread:251
#25 0x00000000004421fc in std::thread::_State_impl<std::thread::_Invoker<std::tuple<std::__future_base::_Async_state_impl<std::thread::_Invoker<std::tuple<CompilerServiceImpl::CompileBuffer(grpc_impl::ServerContext*, buffers::CompileRequest const*, grpc_impl::ServerWriter<buffers::CompileReply>*)::{lambda()#1}> >, void>::_Async_state_impl(std::tuple<CompilerServiceImpl::CompileBuffer(grpc_impl::ServerContext*, buffers::CompileRequest const*, grpc_impl::ServerWriter<buffers::CompileReply>*)::{lambda()#1}>&&)::{lambda()#1}> > >::_M_run() (
    this=0x75c2d80) at C:/msys64/mingw64/include/c++/9.2.0/thread:195
#26 0x000000006fd42441 in ?? () from C:\msys64\mingw64\bin\libstdc++-6.dll
#27 0x0000000064945092 in pthread_create_wrapper ()
   from C:\msys64\mingw64\bin\libwinpthread-1.dll
#28 0x00007ffa1cadb04a in msvcrt!_beginthreadex ()
   from C:\Windows\System32\msvcrt.dll
#29 0x00007ffa1cadb11c in msvcrt!_endthreadex ()
   from C:\Windows\System32\msvcrt.dll
#30 0x00007ffa1cba7bd4 in KERNEL32!BaseThreadInitThunk ()
   from C:\Windows\System32\kernel32.dll
#31 0x00007ffa1de0ced1 in ntdll!RtlUserThreadStart ()
   from C:\Windows\SYSTEM32\ntdll.dll
#32 0x0000000000000000 in ?? ()
Backtrace stopped: previous frame inner to this frame (corrupt stack?)
(gdb)

RobertBColton  

Alright this was partially fixed by #1902 which took care of the crashes, but the logging is still busto. Josh said the mutex is never being unlocked and it's obvious the output is being mangled RGM side. The "Game returned 0" message isn't even getting delivered after closing the game (it does if you compile another empty game).
Please sign in to post comments, or you can view this issue on GitHub.