nakama-cpp icon indicating copy to clipboard operation
nakama-cpp copied to clipboard

Session restore causes crash on Linux

Open mkieweg opened this issue 3 years ago • 5 comments

There seems to be an issue in the Nakama cpp wrapper library for Linux. Restoring a session using the Nakama wrapper results in the following uncaught exception:

[2021.12.14-19.24.25:569][968]LogTemp: [Nakama::RestClient::RestClient] Created. NakamaSdkVersion: 2.5.0
[2021.12.14-19.24.25:569][968]ProjectVNakama: existing session found, restoring session
[2021.12.14-19.24.25:570][968]ProjectVNakama: Stored session token in GameInstance
[2021.12.14-19.24.25:570][968]ProjectVNakama: Handling nakama session, creating Real Time Client instance, assigning listeners and triggering connect (Owner: BP_GameModeProcedural_C_2147482195)
[2021.12.14-19.24.25:570][968]LogTemp: [NRtClient::NRtClient] Created
[2021.12.14-19.24.25:570][968]LogTemp: [NRtClient::connect] ...
CommonUnixCrashHandler: Signal=5
[2021.12.14-19.24.25:602][968]LogCore: === Critical error: ===
Unhandled Exception: SIGTRAP: trace trap

[2021.12.14-19.24.25:602][968]LogCore: Fatal error!

0x00007f7082cc624b libpthread.so.0!raise(+0xcb)
0x00007f7081f70e52 libnakama-cpp.so!UnknownFunction(0x123e51)
0x00007f7081f53ae8 libnakama-cpp.so!_ZNSt16_Sp_counted_baseILN9__gnu_cxx12_Lock_policyE2EE10_M_releaseEv(+0x47)
0x00007f7082141c3c libnakama-cpp.so!UnknownFunction(0x2f4c3b)
0x00007f708223e396 libnakama-cpp.so!UnknownFunction(0x3f1395)
0x00007f70821aa593 libnakama-cpp.so!_ZN5boost4asio6detail9scheduler3runERNS_6system10error_codeE(+0x4a2)
0x00007f708223f116 libnakama-cpp.so!UnknownFunction(0x3f2115)
0x00007f7082193404 libnakama-cpp.so!boost_asio_detail_posix_thread_function(+0x13)
0x00007f7082cba609 libpthread.so.0!UnknownFunction(0x9608)
0x00007f7081c2e293 libc.so.6!clone(+0x42)

[2021.12.14-19.24.25:604][968]LogExit: Executing StaticShutdownAfterError

The same code causing this issue on Linux works as intended on Windows.

mkieweg avatar Dec 14 '21 19:12 mkieweg

@mkieweg , looks like unhandled exception somewhere in our use of cpprest code (https://github.com/microsoft/cpprestsdk/blob/bfe34877914fd280512c97d41aaa99e88564fd8d/Release/include/pplx/pplxtasks.h#L952)

does it stop execution, without exiting, when you run it under debugger? If so maybe this->_M_stackTrace at the place where SIGTRAP was raised could show a bit more about the task with uncaught exception.

Also note to myself, this SO question might be relevant: https://stackoverflow.com/questions/38552098/c-rest-sdk-casablanca-sigtrap

redbaron avatar Jan 22 '22 08:01 redbaron

@mkieweg , would you be be able to post debug logs from Nakama server around the time crash happens? This will help us identify exact calls being made.

redbaron avatar Jan 24 '22 10:01 redbaron

@mkieweg , would you be be able to post debug logs from Nakama server around the time crash happens? This will help us identify exact calls being made.

@redbaron I can totally do that. However, I won't have time for that before the end of the week.

mkieweg avatar Jan 24 '22 11:01 mkieweg

@redbaron sorry for getting back to you just now. Unfortunately I did not get meaningful logs for this from our Nakama dev server and I can't reproduce it with an isolated instance locally. Right now I don't have the resources to look deeper into that matter, sorry.

mkieweg avatar Feb 16 '22 12:02 mkieweg

If you have a chance, try running under debugger and see if generated SIGTRAP will cause it to stop like if it was a breakpoint. Then inspecting this->_M_stackTrace can reveal something useful.

redbaron avatar Feb 16 '22 14:02 redbaron

@mkieweg we've reworked the SDK and this issue should now be resolved.

lugehorsam avatar Sep 19 '22 19:09 lugehorsam