nwnxee / unified

Binaries available under the Releases tab on Github
https://nwnxee.github.io/unified
GNU General Public License v3.0
130 stars 92 forks source link

[NWNX_Area] Server crash in NWNX_Area_ExportGit #1430

Open summonFox opened 3 years ago

summonFox commented 3 years ago

Occasionally we get a server crash on 8193.33 when calling NWNX_Area_ExportGit, I haven't been able to find any reliable reproduction steps for it currently.

 NWNX Signal Handler:
==============================================================
 NWNX 8193.33 (d22461c) has crashed. Fatal error: Segmentation fault (11).
 Please file a bug at https://github.com/nwnxee/unified/issues
==============================================================

  Backtrace:
    /nwn/nwnx/NWNX_Core.so(_ZN7NWNXLib8Platform13GetStackTraceB5cxx11Eh+0x3a) [0x7fba2a8620ea]
    /nwn/nwnx/NWNX_Core.so(nwnx_signal_handler+0x87) [0x7fba2a7b5087]
    /lib/x86_64-linux-gnu/libc.so.6(<UNKNOWN>) [0x7fba2a215840]
    ./nwserver-linux(_ZN15CNWSSoundObject4SaveEP7CResGFFP10CResStruct+0x2c) [0x558d8791c8dc]
    ./nwserver-linux(_ZN8CNWSArea10SaveSoundsEP7CResGFFP10CResStructR13CExoArrayListIjEi+0xf1) [0x558d878d46d1]
    /nwn/nwnx//NWNX_Area.so(ExportGIT+0x526) [0x7fba1d98f3e6]
    /nwn/nwnx/NWNX_Core.so(_ZNSt17_Function_handlerIFN7NWNXLib18ScriptVariantStackEOS1_EPS3_E9_M_invokeERKSt9_Any_dataS2_+0x14) [0x7fba2a7e8c04]
    /nwn/nwnx/NWNX_Core.so(_ZN7NWNXLib6Events4CallERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_+0xac) [0x7fba2a7e841c]
    /nwn/nwnx/NWNX_Core.so(_ZN4Core8NWNXCore16PlaySoundHandlerEP25CNWVirtualMachineCommandsii+0x225) [0x7fba2a7d1495]
    ./nwserver-linux(_ZN15CVirtualMachine11ExecuteCodeEPiSt10shared_ptrI9DataBlockEP31CVirtualMachineDebuggingContext+0x10ed) [0x558d87ceec4d]
    ./nwserver-linux(_ZN15CVirtualMachine13RunScriptFileEi+0xa5) [0x558d87cf0075]
    ./nwserver-linux(_ZN15CVirtualMachine18RunScriptSituationEPvji+0xee) [0x558d87cf02ce]
    ./nwserver-linux(_ZN10CNWSModule12EventHandlerEjjPvjj+0x142) [0x558d87800612]
    ./nwserver-linux(_ZN15CServerAIMaster11UpdateStateEv+0x4e7) [0x558d87882977]
    ./nwserver-linux(_ZN21CServerExoAppInternal8MainLoopEv+0x1ba) [0x558d8789884a]
    /nwn/nwnx//NWNX_Util.so(<UNKNOWN>) [0x7fba1d7d5ac3]
    ./nwserver-linux(<UNKNOWN>) [0x558d87614f45]
    /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xeb) [0x7fba2a20209b]
    ./nwserver-linux(_start+0x2a) [0x558d87618f0a]
summonFox commented 3 years ago

And after having just posted this, I found 100% reliable reproduction steps:

1: Client in Area A logs out from the server. 2: NWNX_Area_ExportGit Area A within a few seconds of Client A logging out. 3: Server crashes.

Here's a reproduction module: ExportGIT_Crash.zip

This will call ExportGIT on the area 1 second after a client logs out of the server, resulting in a crash. As the crash looks like it's coming from SaveSounds I made two areas: One with a sound object and one without. The server crashes when logging out of the server from either area.