• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Segmentation fault core dumped.

Claudiim

New Member
Joined
Sep 29, 2017
Messages
12
Reaction score
0
Help !



my server is crashing and giving the following error in the distro. anyone would know how to ruin? I pay if I have to.

error distro : Segmentation fault core dumped.
 
gdb tfs core.8210
GNU gdb (Ubuntu 12.1-0ubuntu1~22.04) 12.1
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <The GNU General Public License v3.0 - GNU Project - Free Software Foundation (http://gnu.org/licenses/gpl.html)>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "aarch64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<Bugs in GDB (https://www.gnu.org/software/gdb/bugs/)>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from tfs...
[New LWP 8211]
[New LWP 8210]
[New LWP 8213]
[New LWP 8212]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/aarch64-linux-gnu/libthread_db.so.1".
Core was generated by `./tfs'.
--Type <RET> for more, q to quit, c to continue without paging--
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x0000ffffaf82e430 in ?? () from /lib/aarch64-linux-gnu/libluajit-5.1.so.2
[Current thread is 1 (Thread 0xffffae3fc0e0 (LWP 8211))]
(gdb) bt full
#0 0x0000ffffaf82e430 in ?? () from /lib/aarch64-linux-gnu/libluajit-5.1.so.2
No symbol table info available.
#1 0x0000ffffaf828e7c in lua_pcall ()
from /lib/aarch64-linux-gnu/libluajit-5.1.so.2
No symbol table info available.
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
I stop here..
searching "lua_pcall" in src and data files i found it:

\src\combat.cpp (2 ocorrências)
Linha 1465: if (lua_pcall(L, parameters, 2, 0) != 0) {
Linha 1546: if (lua_pcall(L, 2, 0 /nReturnValues/, 0) != 0) {
\src\luascript.cpp (2 ocorrências)
Linha 263: /// Same as lua_pcall, but adds stack trace to error strings in called function.
Linha 270: int ret = lua_pcall(L, nargs, nresults, error_index);
 
other crash..

Using host libthread_db library "/lib/aarch64-linux-gnu/libthread_db.so.1".
Core was generated by `./tfs'.
--Type <RET> for more, q to quit, c to continue without paging--
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x0000ffffae65a9e0 in ?? () from /lib/aarch64-linux-gnu/libluajit-5.1.so.2
[Current thread is 1 (Thread 0xffffad22c0e0 (LWP 18971))]
(gdb)
(gdb) bt full
#0 0x0000ffffae65a9e0 in ?? () from /lib/aarch64-linux-gnu/libluajit-5.1.so.2
No symbol table info available.
#1 0x0000ffffae65abb8 in ?? () from /lib/aarch64-linux-gnu/libluajit-5.1.so.2
No symbol table info available.
#2 0x0000ffffae65f1dc in ?? () from /lib/aarch64-linux-gnu/libluajit-5.1.so.2
No symbol table info available.
#3 0x0000ffffaca1d000 in ?? ()
No symbol table info available.
Backtrace stopped: previous frame inner to this frame (corrupt stack?)

help pls ;~
 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/aarch64-linux-gnu/libthread_db.so.1".
Core was generated by `./tfs'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 Game::internalTeleport(Thing*, Position const&, bool, unsigned int) [clone .constprop.0] (this=0xaaaae7a1abd8 <g_game>, thing=0x1ffff1a67edc0, newPos=...,
pushMove=false, flags=0) at /var/www/ot/nost/src/game.cpp:1588
1588 if (newPos == thing->getPosition()) {
[Current thread is 1 (Thread 0xffff931fc0e0 (LWP 10911))]
(gdb) bt ful
#0 Game::internalTeleport(Thing*, Position const&, bool, unsigned int) [clone .constprop.0] (this=0xaaaae7a1abd8 <g_game>, thing=0x1ffff1a67edc0, newPos=...,
pushMove=false, flags=0) at /var/www/ot/nost/src/game.cpp:1588
toTile = <optimized out>
#1 0x0000aaaae791ab38 in LuaScriptInterface::luaCreatureTeleportTo (
L=0x44be63dcb378) at /var/www/ot/nost/src/luascript.cpp:6773
pushMovement = false
position = @0xffff931fb550: {x = 33088, y = 32588, z = 6 '\006'}
creature = 0xffff8d551730
oldPosition = {x = 41440, y = 36189, z = <optimized out>}
#2 0x0000ffff94619394 in ?? () from /lib/aarch64-linux-gnu/libluajit-5.1.so.2
No symbol table info available.
#3 0x0000ffff94628e7c in lua_pcall () from /lib/aarch64-linux-gnu/libluajit-5.1.so.2
No symbol table info available.
#4 0x0000aaaae78e6868 in LuaScriptInterface::protectedCall (L=0x44be63dcb378,
nargs=nargs@entry=1, nresults=nresults@entry=1)
at /var/www/ot/nost/src/luascript.cpp:270
error_index = 4
ret = <optimized out>
#5 0x0000aaaae78e7b2c in LuaScriptInterface::callFunction (
this=0xaaaae7a1aa00 <g_luaEnvironment>, params=1)
at /var/www/ot/nost/src/luascript.cpp:494
result = false
size = 5
#6 0x0000aaaae792ae24 in LuaEnvironment::executeTimerEvent (
this=0xaaaae7a1aa00 <g_luaEnvironment>, eventIndex=<optimized out>)
at /usr/include/c++/11/bits/stl_list.h:404
env = <optimized out>
it = <optimized out>
timerEventDesc = {scriptId = 1000, function = 14,
--Type <RET> for more, q to quit, c to continue without paging--
parameters = std::__cxx11::list = {[0] = 9}, eventId = 5411042}
#7 0x0000aaaae7974a74 in std::function<void ()>::eek:perator()() const (
this=0xffff8d4c1b60) at /usr/include/c++/11/bits/std_function.h:590
No locals.
#8 Task::eek:perator() (this=0xffff8d4c1b50) at /var/www/ot/nost/src/tasks.h:40
No locals.
#9 Dispatcher::threadMain (this=0xaaaae7a1bea0 <g_dispatcher>)
at /var/www/ot/nost/src/tasks.cpp:50
task = 0xffff8d4c1b50
taskLockUnique = {_M_device = 0xaaaae7a1beb8 <g_dispatcher+24>,
_M_owns = false}
#10 0x0000ffff93ca31fc in ?? () from /lib/aarch64-linux-gnu/libstdc++.so.6
No symbol table info available.
#11 0x0000ffff93a6d5c8 in start_thread (arg=0x0) at ./nptl/pthread_create.c:442
ret = <optimized out>
pd = 0x0
out = <optimized out>
unwind_buf = {cancel_jmp_buf = {{jmp_buf = {281473150075104,
281474362054864, 281474362054862, 8448288, 281474362054863, 0,
281473141624832, 8448288, 281473172287520, 281473141624832,
281473150072832, 13882581889327205330, 0, 13882581889319430094, 0,
0, 0, 0, 0, 0, 0, 0}, mask_was_saved = 0}}, priv = {pad = {0x0, 0x0,
0x0, 0x0}, data = {prev = 0x0, cleanup = 0x0, canceltype = 0}}}
not_first_call = 0
#12 0x0000ffff93ad5d1c in thread_start ()
at ../sysdeps/unix/sysv/linux/aarch64/clone.S:79
where to start? :~
 
It looks like it's crashing from a LUA call to luaCreatureTeleportTo()
Something between positions {x = 33088, y = 32588, z = 6'} and {x = 41440, y = 36189, z = ??}

Do you have any LUA scripts that call addEvent() function?
 
It looks like it's crashing from a LUA call to luaCreatureTeleportTo()
Something between positions {x = 33088, y = 32588, z = 6'} and {x = 41440, y = 36189, z = ??}

Do you have any LUA scripts that call addEvent() function?
I checked here it seems that in this case the problem is easy.. I found the script.

Is there any way to check if the player is online during the function?
like " if not player 'online' return true" ?
if i put "if not player return true" dont work
 
I checked here it seems that in this case the problem is easy.. I found the script.

Is there any way to check if the player is online during the function?
like " if not player 'online' return true" ?
if i put "if not player return true" dont work

Can you show the script? You should never pass an object, you should always pass the index and then try to find the object again in the event that's called later and bail out if it can no longer be found.

Like this
1670597642149.png
 
i'm using it on loggout, to show players online on console and the gm temple before logout to dont show my "logout effect" if i'm in ghost mode:
loggout.lua creaturevent
--print players on console
function consoleplayersOnline(interval)

local players = Game.getPlayers()
local onlineList = {}

for _, targetPlayer in ipairs(players) do
table.insert(onlineList, ("%s [%d]"):format(targetPlayer:getName(), targetPlayer:getLevel()))
end
local playersOnline = #onlineList
print(("%d players online."):format(playersOnline))

end


--logout
function onLogout(player)



--addevent to show players online on console below player logout.

addEvent(consoleplayersOnline, 1)



--god goes temple

if not player:getGroup():getAccess() then
return true
end

if player:getAccountType() < ACCOUNT_TYPE_GAMEMASTER then
return false
end

player:teleportTo(player:getTown():getTemplePosition())


return true
end

can u please explain what i do with return, return true and false?
I use it by deduction but I didn't learn it
 
Why does this event need to be a timed event? Why not just get the list on logout?

Also, why is it teleporting players to temple on logout? Why not just do that on login and make them always login at town?
 
Why does this event need to be a timed event? Why not just get the list on logout?

Also, why is it teleporting players to temple on logout? Why not just do that on login and make them always login at town?
it's only the gm that teleports to the temple.. as i said, so when i log out in ghost mode, it doesn't show the logout puff effect to a player, cause i really loggout in temple (island) and nobody see the puff. it to players dont see my ghost activite

and the event i put this "delay" because i would like the message on the console of players that stayed on the server to be after the "player has loggout."do you understand?:
"player has loggout.
10 players online."

is there another way to make this delay?
if i put without event, the message came before life that:

"10 players online.
player has loggout." - and now have 10 players on server..
 
Are you trying to print out a list of all players, or just the online player count?

The add event in this cause shouldn't be the problem since you're just printing the number of players online, you can simplify this however to:
Lua:
function consoleplayersOnline(interval)
    local players = Game.getPlayers()
    print(("%d players online."):format(#players))
end

The rest trying to teleport the player after he's logged out is probably what's causing the issue. Frankly if what you're trying to do is make it so people don't notice the GM logging in or out is just edit the sources to skip doing the animation at all for any character that has GM access.
 
Are you trying to print out a list of all players, or just the online player count?

The add event in this cause shouldn't be the problem since you're just printing the number of players online, you can simplify this however to:
Lua:
function consoleplayersOnline(interval)
    local players = Game.getPlayers()
    print(("%d players online."):format(#players))
end

The rest trying to teleport the player after he's logged out is probably what's causing the issue. Frankly if what you're trying to do is make it so people don't notice the GM logging in or out is just edit the sources to skip doing the animation at all for any character that has GM access.
"The rest trying to teleport the player after he's logged out is probably what's causing the issue. Frankly if what you're trying to do is make it so people don't notice the GM logging in or out is just edit the sources to skip doing the animation at all for any character that has GM access." \

I thought about doing this. but I found this script easier. I tested many times to log out and I didn't have any problems with god.
just after i put this addevent.

and yes, in this case only the number of players. I will simplify, do you think this would have caused the crash?
the last crash apparently was generated because of "addevents"

it looked like this before the crash:
[11/12/22-(20:36:53)] Maniman has logged out.
[11/12/22-(20:36:53)] 2 players online.
[11/12/22-(20:36:53)] 2 players online.

2 events "consoleplayersOnline" ;s
--edit
and please, exists removeEvent? it works to stop an event player on before loggout?
 
Last edited:
The crash appears to be from the luaCreatureTeleportTo() call, possibly because when you're running live server with some latency it's logging out before it's doing the teleporter.

You should just skip saving the last known position for gm chars or something
 
i'm using it on loggout, to show players online on console and the gm temple before logout to dont show my "logout effect" if i'm in ghost mode:
loggout.lua creaturevent


can u please explain what i do with return, return true and false?
I use it by deduction but I didn't learn it
It's not a problem with script you posted. teleportTo is executed in onLogout event, not in addEvent.
Crash happened in some script that call teleportTo inside function called by addEvent.
It tried to teleport creature to {x = 33088, y = 32588, z = 6 '\006'}. Creature position was {x = 41440, y = 36189, z = <optimized out>}, which is probably not valid position, as it was loaded from Creature that did not exist in RAM.
The crash appears to be from the luaCreatureTeleportTo() call, possibly because when you're running live server with some latency it's logging out before it's doing the teleporter.

You should just skip saving the last known position for gm chars or something
If you mean script posted above with player:teleportTo executed in onLogout, it's impossible to crash.
It cannot logout before executing teleport, as event onLogout is executed during logout. If this script freezes [ex. long/infinite loop in Lua], it will block logout and it will freez whole server, as all C++/Lua actions are executed synchronously.
 
It's not a problem with script you posted. teleportTo is executed in onLogout event, not in addEvent.
Crash happened in some script that call teleportTo inside function called by addEvent.
It tried to teleport creature to {x = 33088, y = 32588, z = 6 '\006'}. Creature position was {x = 41440, y = 36189, z = <optimized out>}, which is probably not valid position, as it was loaded from Creature that did not exist in RAM.

If you mean script posted above with player:teleportTo executed in onLogout, it's impossible to crash.
It cannot logout before executing teleport, as event onLogout is executed during logout. If this script freezes [ex. long/infinite loop in Lua], it will block logout and it will freez whole server, as all C++/Lua actions are executed synchronously.


the crash log with this teleportTO is not from this script.

the log script form the crash, I stopped using, because it could teleport even after a logout (I found another solution for this case).

I figured that logout script could be a problem too because it has the addEvent, but it's just a print. and I noticed it ran before it crashed, but I get nothing but logs like this:
Core was generated by `./tfs'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x0000ffffa6c6a608 in ?? ()
[Current thread is 1 (LWP 30834)]
(gdb) bt full
#0 0x0000ffffa6c6a608 in ?? ()
No symbol table info available.
#1 0x00007bf6e6eb5378 in ?? ()
No symbol table info available.
Backtrace stopped: previous frame inner to this frame (corrupt stack?)
I already tried to compile with both forms for log information, "cmake -DCMAKE_BUILD_TYPE=Debug .." and " cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo .." like here: Compiling debug binaries in cmake · otland/forgottenserver Wiki (https://github.com/otland/forgottenserver/wiki/Compiling-debug-binaries-in-cmake)

as I can't find a complete log, I'm trying to find out what it could be. so I thought it might be the logout. because I saw that it crashed after a while of a logout.

could some other debugger give me better logs or would it be the same as gdb?
 
Can you show the script? You should never pass an object, you should always pass the index and then try to find the object again in the event that's called later and bail out if it can no longer be found.

Like this
View attachment 72210
looking it.. my server is crashing in some SS.. my script is a problem?
local cleanMapAtServerSavenoclose = false

local function serverSavenoclose()

saveServer()
broadcastMessage("", MESSAGE_STATUS_WARNING)
broadcastMessage("Server Saved!", MESSAGE_EVENT_ADVANCE)
print("SS: " .. os.date("%c"))

end

local function serverSavenoclosewarn()
broadcastMessage("Saving Server..", MESSAGE_STATUS_WARNING)
addEvent(serverSavenoclose, 250)
end

local function secondServerSaveWarningnoclose()
broadcastMessage("Server Save in 15 seconds.\nPlease be safe.\nMay freeze for a few seconds.", MESSAGE_STATUS_WARNING)
addEvent(serverSavenoclosewarn, 14750)
end

local function firstServerSaveWarningnoclose()
broadcastMessage("Server Save in one minute.\nPlease be safe.\nMay freeze for a few seconds.", MESSAGE_EVENT_ADVANCE)
addEvent(secondServerSaveWarningnoclose, 45000)
end

function onTime(interval)
broadcastMessage("Server Save in 3 minutes.\nPlease be safe.\nMay freeze for a few seconds.", MESSAGE_EVENT_ADVANCE)
addEvent(firstServerSaveWarningnoclose, 120000)
return not cleanMapAtServerSavenoclose
end
this return may be wrong? ;s
 
Doesn't looks like it. But the backtrace just says "previous frame inner to this frame (corrupt stack?)" so it's impossible to tell from that.

May need to run in a debug build, check your server system utilisation or may have to use something like valgrind.
 
Doesn't looks like it. But the backtrace just says "previous frame inner to this frame (corrupt stack?)" so it's impossible to tell from that.

May need to run in a debug build, check your server system utilisation or may have to use something like valgrind.
I already compiled with a flash "DCMAKE_BUILD_TYPE=RelWithDebInfo .."
and with "-DCMAKE_BUILD_TYPE=Debug .." in cmake, as it says in the tutorial:

but it continues like this, would this compile with debug?
you research about valgrind ;s
 
Back
Top