nwnxee / unified

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

Segmentation fault (11) #1782

Closed Darsiniux closed 1 month ago

Darsiniux commented 1 month ago

Hi I just downloaded NWNX today. I enabled the NWNX_ADMINISTRATION_SKIP plugin and ran a script to delete a character in a NPC conversation. NWNX_Administration_DeletePlayerCharacter(oPC, FALSE, "Charachter was deleted."); the script works after enabling the plugin but it crashes the whole server.  Below is a log of the error and the print out of the terminal.

nwserverLog1.txt

I [15:59:05] [NWNX_ServerLogRedirector] [ServerLogRedirector.cpp:41] (Server) UUID COLLISION: Tried to load and assign UUID 5a39b469-0337-4779-96ff-73777dbdc331, but UUID already in module. I [15:59:05] [NWNX_ServerLogRedirector] [ServerLogRedirector.cpp:41] (Server) UUID COLLISION: Tried to load and assign UUID b4eb28a5-4e4c-4b07-a4f7-9f769e9b0fe9, but UUID already in module. I [15:59:05] [NWNX_ServerLogRedirector] [ServerLogRedirector.cpp:41] (Server) UUID COLLISION: Tried to load and assign UUID a9e87b0e-bc5a-49c1-985f-a80e324fd06d, but UUID already in module. I [15:59:05] [NWNX_ServerLogRedirector] [ServerLogRedirector.cpp:41] (Server) UUID COLLISION: Tried to load and assign UUID de83abf5-e0ce-459a-946c-d871e5f8e6c7, but UUID already in module. I [15:59:05] [NWNX_ServerLogRedirector] [ServerLogRedirector.cpp:41] (Server) UUID COLLISION: Tried to load and assign UUID e60b6ad0-959b-4c9c-8f3d-f4631eb35035, but UUID already in module. I [15:59:05] [NWNX_ServerLogRedirector] [ServerLogRedirector.cpp:41] (Server) UUID COLLISION: Tried to load and assign UUID e7bf0db9-0374-485f-9080-70b4c5293cea, but UUID already in module. I [15:59:05] [NWNX_ServerLogRedirector] [ServerLogRedirector.cpp:41] (Server) UUID COLLISION: Tried to load and assign UUID abb16926-ff1a-4f80-acdc-1e9bbad078fd, but UUID already in module. I [15:59:05] [NWNX_ServerLogRedirector] [ServerLogRedirector.cpp:41] (Server) UUID COLLISION: Tried to load and assign UUID d3fce3a2-64c8-4855-9b9e-e71f71a9961f, but UUID already in module. I [15:59:05] [NWNX_ServerLogRedirector] [ServerLogRedirector.cpp:41] (Server) UUID COLLISION: Tried to load and assign UUID 1154cc4f-739f-42a9-9739-88c1e381f92f, but UUID already in module. I [15:59:05] [NWNX_ServerLogRedirector] [ServerLogRedirector.cpp:41] (Server) UUID COLLISION: Tried to load and assign UUID 5a4767a0-1285-42ea-8313-91c4ef96d8cf, but UUID already in module. I [15:59:05] [NWNX_ServerLogRedirector] [ServerLogRedirector.cpp:41] (Server) UUID COLLISION: Tried to load and assign UUID 990b8111-5e28-4191-8a78-ba8518c9b8da, but UUID already in module. I [15:59:05] [NWNX_ServerLogRedirector] [ServerLogRedirector.cpp:41] (Server) UUID COLLISION: Tried to load and assign UUID b17f2c53-9ba3-4d7b-bbfe-93028379846d, but UUID already in module. I [15:59:05] [NWNX_ServerLogRedirector] [ServerLogRedirector.cpp:41] (Server) UUID COLLISION: Tried to load and assign UUID cd058645-3d7a-43ac-8397-cf853888a773, but UUID already in module. I [15:59:05] [NWNX_ServerLogRedirector] [ServerLogRedirector.cpp:41] (Server) UUID COLLISION: Tried to load and assign UUID 721b4445-4cd9-43aa-a079-b960b89b7b12, but UUID already in module. N [15:59:13] [NWNX_Administration] [Administration.cpp:132] Deleting /home/cw174531/.local/share/Neverwinter Nights/servervault/QRMA6EAM/rodorflomen.bic (no backup) I [15:59:13] [NWNX_ServerLogRedirector] [ServerLogRedirector.cpp:41] (Server) Darsiniux Left as a Player (0 players left) I [15:59:13] [NWNX_ServerLogRedirector] [ServerLogRedirector.cpp:41] (Server) Loading Module: Bloodlands-07 NWNX Signal Handler:

NWNX 8193.36-12 (695efc6023) has crashed. Fatal error: Segmentation fault (11). Please file a bug at https://github.com/nwnxee/unified/issues

cw174531@C3PO:~$ /home/cw174531/unified/Binaries/NWNX_Core.so(_ZN7NWNXLib8Platform13GetStackTraceB5cxx11Eh+0x64) [0x7faec6a3f014] /home/cw174531/unified/Binaries/NWNX_Core.so(nwnx_signal_handler+0xd5) [0x7faec69ec9e5] /lib/x86_64-linux-gnu/libc.so.6(+0x42520) [0x7faec648a520] /home/cw174531/unified/Binaries/NWNX_Administration.so(+0x9be2) [0x7faec441abe2] /home/cw174531/unified/Binaries/NWNX_Administration.so(+0xc1a9) [0x7faec441d1a9] /home/cw174531/unified/Binaries/NWNX_Core.so(_ZN7NWNXLib5Tasks21ProcessMainThreadWorkEv+0x140) [0x7faec6a31f80] /home/cw174531/unified/Binaries/NWNX_Core.so(_ZN4Core8NWNXCore23MainLoopInternalHandlerEP21CServerExoAppInternal+0x28) [0x7faec69e9de8] ./nwserver-linux(main+0x13f5) [0x563d41bee8f5] /lib/x86_64-linux-gnu/libc.so.6(+0x29d90) [0x7faec6471d90] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x80) [0x7faec6471e40] ./nwserver-linux(_start+0x2a) [0x563d41bf343a] ./run-server.sh: line 86: 752 Aborted LD_PRELOAD=~/unified/Binaries/NWNX_Core.so ./nwserver-linux -module "Bloodlands-07" -maxclients 30 -minlevel 1 -maxlevel 40 -pauseandplay 0 -pvp 2 -servervault 1 -elc 1 -ilr 1 -gametype 3 -oneparty 0 -difficulty 3 -autosaveinterval 0 -playerpassword '' -dmpassword 'CheatModeEnabled' -servername '0-Bloodlands' -publicserver 1 -reloadwhenempty 1 -port 5121 ~

Daztek commented 1 month ago

The issue is likely -reloadwhenempty 1, it's not something NWNX supports, if you want to reload the module, it's best to shutdown the server and have an outside script / cronjob bring it back up

Darsiniux commented 1 month ago

Thanks, that's exactly what the problem was.

Darsiniux commented 1 month ago

Also, thanks for your advice about using a cronjob to automate the server. I'm kind of a newb here though. I tried creating a nwn_shutdown.sh script which kills the run_server.sh but the problem is that killing the run_server.sh doesn't kill the server. You wouldn't happen to know what process I need to kill in order to shut it down would you? Thanks again for the help.

[EDIT]

It was a small typo. I got the run-server.sh script to kill the process but it didn't shut down the physical server itself. So, as of now the server is still running but I have no way of shutting it down aside from restarting my internet.

[EDIT #2]

Nevermind I figured it out!

Arvirago commented 1 month ago

In case someone else has same question, this is the stop.sh I use:

#!/bin/bash
if pgrep -x nwserver-linux > /dev/null
then
    echo "Cerrando servidor de Aldor."
    kill $(pgrep -x nwserver-linux)
fi
hendrikgit commented 1 month ago

In case someone else has same question, this is the stop.sh I use:

#!/bin/bash
if pgrep -x nwserver-linux > /dev/null
then
  echo "Cerrando servidor de Aldor."
  kill $(pgrep -x nwserver-linux)
fi

Not that it matters but there is a pkill you can call with the same options as pgrep, instead of passing the result from pgrep to kill. You could even pkill directly and print the message depending on the exit status of that pkill. Sorry ;)

Darsiniux commented 1 month ago

NOTE: If you directly kill the run-server.sh the server will continue running but it will show on the terminal as if it's down. I had to manually find the process with netstat -tuln | grep 5121 (port of server) and then kill it. It's safer to kill nwserver-linux.

!/bin/bash

Command to shut down NWNX server

echo "Shutting down NWN server.." pkill -f nwserver-linux echo "Shut down complete!"

Arvirago commented 1 month ago

Not that it matters but there is a pkill you can call with the same options as pgrep, instead of passing the result from pgrep to kill. You could even pkill directly and print the message depending on the exit status of that pkill. Sorry ;)

Thanks. Since I only want the message when successful, I did:

#!/bin/bash
pkill -x nwserver-linux
if [ $? -eq 0 ]; then
        echo "Cerrando servidor de Aldor"
fi