• 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!
  • If you're using Gesior 2012 or MyAAC, please review this thread for information about a serious security vulnerability and a fix.

TFS 1.X+ Creature.cpp problem - bool Creature::canSee

Zodia

Member
Joined
Feb 21, 2020
Messages
219
Reaction score
17
My server is crashing all the time. I believe the problem is there, even if I can't understand it to solve. Could anyone help me to solve this problem?

Lua:
received signal SIGSEGV, Segmentation fault.
2022-03-06 07:53:53 -  [Switching to Thread 0x7ffff4fe6700 (LWP 301)]
2022-03-06 07:53:53 -  0x00005555555dabe5 in Creature::canSee (myPos=..., pos=..., viewRangeX=9, viewRangeY=9) at /media/studio/src/creature.cpp:53
2022-03-06 07:53:53 -  53        if (myPos.z <= 7) {
2022-03-06 07:53:53 - 
2022-03-06 07:53:53 -  Thread 4 (Thread 0x7ffff3dd2700 (LWP 303)):
2022-03-06 07:53:53 -  #0  0x00007ffff6ab9ad3 in futex_wait_cancelable (private=<optimized out>, expected=0, futex_word=0x55555597c6dc <g_databaseTasks+188>) at ../sysdeps/unix/sysv/linux/futex-internal.h:88
2022-03-06 07:53:53 -          __ret = -512
2022-03-06 07:53:53 -          oldtype = 0
2022-03-06 07:53:53 -          err = <optimized out>
2022-03-06 07:53:53 -          oldtype = <optimized out>
2022-03-06 07:53:53 -          err = <optimized out>
2022-03-06 07:53:53 -          __ret = <optimized out>
2022-03-06 07:53:53 -          resultvar = <optimized out>
2022-03-06 07:53:53 -          __arg4 = <optimized out>
2022-03-06 07:53:53 -          __arg3 = <optimized out>
2022-03-06 07:53:53 -          __arg2 = <optimized out>
2022-03-06 07:53:53 -          __arg1 = <optimized out>
2022-03-06 07:53:53 -          _a4 = <optimized out>
2022-03-06 07:53:53 -          _a3 = <optimized out>
2022-03-06 07:53:53 -          _a2 = <optimized out>
2022-03-06 07:53:53 -          _a1 = <optimized out>
2022-03-06 07:53:53 -  #1  __pthread_cond_wait_common (abstime=0x0, mutex=0x55555597c688 <g_databaseTasks+104>, cond=0x55555597c6b0 <g_databaseTasks+144>) at pthread_cond_wait.c:502
2022-03-06 07:53:53 -          spin = 0
2022-03-06 07:53:53 -          buffer = {__routine = 0x7ffff6ab9770 <__condvar_cleanup_waiting>, __arg = 0x7ffff3dd1d70, __canceltype = -156534702, __prev = 0x0}
2022-03-06 07:53:53 -          cbuffer = {wseq = 3, cond = 0x55555597c6b0 <g_databaseTasks+144>, mutex = 0x55555597c688 <g_databaseTasks+104>, private = 0}
2022-03-06 07:53:53 -          rt = <optimized out>
2022-03-06 07:53:53 -          err = <optimized out>
2022-03-06 07:53:53 -          g = 1
2022-03-06 07:53:53 -          flags = <optimized out>
2022-03-06 07:53:53 -          g1_start = <optimized out>
2022-03-06 07:53:53 -          signals = <optimized out>
2022-03-06 07:53:53 -          result = 0
2022-03-06 07:53:53 -          wseq = <optimized out>
2022-03-06 07:53:53 -          seq = 1
2022-03-06 07:53:53 -          private = <optimized out>
2022-03-06 07:53:53 -          maxspin = <optimized out>
2022-03-06 07:53:53 -          err = <optimized out>
2022-03-06 07:53:53 -          result = <optimized out>
2022-03-06 07:53:53 -          wseq = <optimized out>
2022-03-06 07:53:53 -          g = <optimized out>
2022-03-06 07:53:53 -          seq = <optimized out>
2022-03-06 07:53:53 -          flags = <optimized out>
2022-03-06 07:53:53 -          private = <optimized out>
2022-03-06 07:53:53 -          signals = <optimized out>
2022-03-06 07:53:53 -          g1_start = <optimized out>
2022-03-06 07:53:53 -          spin = <optimized out>
2022-03-06 07:53:53 -          buffer = <optimized out>
2022-03-06 07:53:53 -          cbuffer = <optimized out>
2022-03-06 07:53:53 -          rt = <optimized out>
2022-03-06 07:53:53 -          s = <optimized out>
2022-03-06 07:53:53 -  #2  __pthread_cond_wait (cond=0x55555597c6b0 <g_databaseTasks+144>, mutex=0x55555597c688 <g_databaseTasks+104>) at pthread_cond_wait.c:655
2022-03-06 07:53:53 -  No locals.
2022-03-06 07:53:53 -  #3  0x00007ffff67da8bc in std::condition_variable::wait(std::unique_lock<std::mutex>&) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
2022-03-06 07:53:53 -  No symbol table info available.
2022-03-06 07:53:53 -  #4  0x00005555555e8471 in DatabaseTasks::threadMain (this=0x55555597c620 <g_databaseTasks>) at /media/studio/src/databasetasks.cpp:40
2022-03-06 07:53:53 -          taskLockUnique = {_M_device = 0x55555597c688 <g_databaseTasks+104>, _M_owns = true}
2022-03-06 07:53:53 -  #5  0x00007ffff67e06df in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
2022-03-06 07:53:53 -  No symbol table info available.
2022-03-06 07:53:53 -  #6  0x00007ffff6ab36db in start_thread (arg=0x7ffff3dd2700) at pthread_create.c:463
2022-03-06 07:53:53 -          pd = 0x7ffff3dd2700
2022-03-06 07:53:53 -          now = <optimized out>
2022-03-06 07:53:53 -          unwind_buf = {cancel_jmp_buf = {{jmp_buf = {140737284744960, 2649706120571378622, 140737284743040, 0, 140737153180864, 140737303698288, -2649732761143354434, -2649725184011805762}, mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x0, 0x0}, data = {prev = 0x0, cleanup = 0x0, canceltype = 0}}}
2022-03-06 07:53:53 -          not_first_call = <optimized out>
2022-03-06 07:53:53 -  #7  0x00007ffff5e9d61f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
2022-03-06 07:53:53 -  No locals.
2022-03-06 07:53:53 - 
2022-03-06 07:53:53 -  Thread 3 (Thread 0x7ffff47e5700 (LWP 302)):
2022-03-06 07:53:53 -  #0  0x00007ffff6aba065 in futex_abstimed_wait_cancelable (private=<optimized out>, abstime=0x7ffff47e4e30, expected=0, futex_word=0x55555597c4cc <g_scheduler+108>) at ../sysdeps/unix/sysv/linux/futex-internal.h:205
2022-03-06 07:53:53 -          __ret = -516
2022-03-06 07:53:53 -          oldtype = 0
2022-03-06 07:53:53 -          err = <optimized out>
2022-03-06 07:53:53 -          oldtype = <optimized out>
2022-03-06 07:53:53 -          err = <optimized out>
2022-03-06 07:53:53 -          __ret = <optimized out>
2022-03-06 07:53:53 -          resultvar = <optimized out>
2022-03-06 07:53:53 -          __arg6 = <optimized out>
2022-03-06 07:53:53 -          __arg5 = <optimized out>
2022-03-06 07:53:53 -          __arg4 = <optimized out>
2022-03-06 07:53:53 -          __arg3 = <optimized out>
2022-03-06 07:53:53 -          __arg2 = <optimized out>
2022-03-06 07:53:53 -          __arg1 = <optimized out>
2022-03-06 07:53:53 -          _a6 = <optimized out>
2022-03-06 07:53:53 -          _a5 = <optimized out>
2022-03-06 07:53:53 -          _a4 = <optimized out>
2022-03-06 07:53:53 -          _a3 = <optimized out>
2022-03-06 07:53:53 -          _a2 = <optimized out>
2022-03-06 07:53:53 -          _a1 = <optimized out>
2022-03-06 07:53:53 -  #1  __pthread_cond_wait_common (abstime=0x7ffff47e4e30, mutex=0x55555597c478 <g_scheduler+24>, cond=0x55555597c4a0 <g_scheduler+64>) at pthread_cond_wait.c:539
2022-03-06 07:53:53 -          spin = 0
2022-03-06 07:53:53 -          buffer = {__routine = 0x7ffff6ab9770 <__condvar_cleanup_waiting>, __arg = 0x7ffff47e4da0, __canceltype = 1436184992, __prev = 0x0}
2022-03-06 07:53:53 -          cbuffer = {wseq = 991971, cond = 0x55555597c4a0 <g_scheduler+64>, mutex = 0x55555597c478 <g_scheduler+24>, private = 0}
2022-03-06 07:53:53 -          err = <optimized out>
2022-03-06 07:53:53 -          g = 1
2022-03-06 07:53:53 -          flags = <optimized out>
2022-03-06 07:53:53 -          g1_start = <optimized out>
2022-03-06 07:53:53 -          maxspin = 0
2022-03-06 07:53:53 -          signals = <optimized out>
2022-03-06 07:53:53 -          result = 0
2022-03-06 07:53:53 -          wseq = <optimized out>
2022-03-06 07:53:53 -          seq = 495985
2022-03-06 07:53:53 -          private = <optimized out>
2022-03-06 07:53:53 -          maxspin = <optimized out>
2022-03-06 07:53:53 -          err = <optimized out>
2022-03-06 07:53:53 -          result = <optimized out>
2022-03-06 07:53:53 -          wseq = <optimized out>
2022-03-06 07:53:53 -          g = <optimized out>
2022-03-06 07:53:53 -          seq = <optimized out>
2022-03-06 07:53:53 -          flags = <optimized out>
2022-03-06 07:53:53 -          private = <optimized out>
2022-03-06 07:53:53 -          signals = <optimized out>
2022-03-06 07:53:53 -          g1_start = <optimized out>
2022-03-06 07:53:53 -          spin = <optimized out>
2022-03-06 07:53:53 -          buffer = <optimized out>
2022-03-06 07:53:53 -          cbuffer = <optimized out>
2022-03-06 07:53:53 -          rt = <optimized out>
2022-03-06 07:53:53 -          s = <optimized out>
2022-03-06 07:53:53 -  #2  __pthread_cond_timedwait (cond=0x55555597c4a0 <g_scheduler+64>, mutex=0x55555597c478 <g_scheduler+24>, abstime=0x7ffff47e4e30) at pthread_cond_wait.c:667
2022-03-06 07:53:53 -  No locals.
2022-03-06 07:53:53 -  #3  0x00005555556eb4d8 in __gthread_cond_timedwait (__abs_timeout=0x7ffff47e4e30, __mutex=<optimized out>, __cond=0x55555597c4a0 <g_scheduler+64>) at /usr/include/x86_64-linux-gnu/c++/7/bits/gthr-default.h:871
2022-03-06 07:53:53 -  No locals.
2022-03-06 07:53:53 -  #4  std::condition_variable::__wait_until_impl<std::chrono::duration<long, std::ratio<1l, 1000000000l> > > (__atime=..., __lock=..., this=0x55555597c4a0 <g_scheduler+64>) at /usr/include/c++/7/condition_variable:178
2022-03-06 07:53:53 -          __s = <optimized out>
2022-03-06 07:53:53 -          __ns = <optimized out>
2022-03-06 07:53:53 -          __ts = {tv_sec = 1646564033, tv_nsec = 35144579}
2022-03-06 07:53:53 -          __s = <optimized out>
2022-03-06 07:53:53 -          __ns = <optimized out>
2022-03-06 07:53:53 -          __ts = <optimized out>
2022-03-06 07:53:53 -  #5  std::condition_variable::wait_until<std::chrono::duration<long, std::ratio<1l, 1000000000l> > > (__atime=..., __lock=..., this=0x55555597c4a0 <g_scheduler+64>) at /usr/include/c++/7/condition_variable:106
2022-03-06 07:53:53 -  No locals.
2022-03-06 07:53:53 -  #6  Scheduler::threadMain (this=0x55555597c460 <g_scheduler>) at /media/studio/src/scheduler.cpp:34
2022-03-06 07:53:53 -          ret = std::cv_status::no_timeout
2022-03-06 07:53:53 -          eventLockUnique = {_M_device = 0x55555597c478 <g_scheduler+24>, _M_owns = true}
2022-03-06 07:53:53 -  #7  0x00007ffff67e06df in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
2022-03-06 07:53:53 -  No symbol table info available.
2022-03-06 07:53:53 -  #8  0x00007ffff6ab36db in start_thread (arg=0x7ffff47e5700) at pthread_create.c:463
2022-03-06 07:53:53 -          pd = 0x7ffff47e5700
2022-03-06 07:53:53 -          now = <optimized out>
2022-03-06 07:53:53 -          unwind_buf = {cancel_jmp_buf = {{jmp_buf = {140737295308544, 2649706120571378622, 140737295306624, 0, 93824996764800, 140737488346224, -2649720420091700290, -2649725184011805762}, mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x0, 0x0}, data = {prev = 0x0, cleanup = 0x0, canceltype = 0}}}
2022-03-06 07:53:53 -          not_first_call = <optimized out>
2022-03-06 07:53:53 -  #9  0x00007ffff5e9d61f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
2022-03-06 07:53:53 -  No locals.
2022-03-06 07:53:53 - 
2022-03-06 07:53:53 -  Thread 2 (Thread 0x7ffff4fe6700 (LWP 301)):
2022-03-06 07:53:53 -  #0  0x00005555555dabe5 in Creature::canSee (myPos=..., pos=..., viewRangeX=9, viewRangeY=9) at /media/studio/src/creature.cpp:53
2022-03-06 07:53:53 -          offsetz = <optimized out>
2022-03-06 07:53:53 -  #1  0x00005555555dd178 in Creature::onCreatureMove ([email protected]=0x7fffcea38660, [email protected]=0x7fffcf0a0ce0, newTile=0x7fffaaae0a70, newPos=..., oldTile=0x7fffaaad8a10, oldPos=..., teleport=false) at /media/studio/src/creature.cpp:598
2022-03-06 07:53:53 -  No locals.
2022-03-06 07:53:53 -  #2  0x000055555569ac68 in Monster::onCreatureMove (this=0x7fffcea38660, creature=0x7fffcf0a0ce0, newTile=<optimized out>, newPos=..., oldTile=<optimized out>, oldPos=..., teleport=false) at /media/studio/src/monster.cpp:185
2022-03-06 07:53:54 -  No locals.
2022-03-06 07:53:54 -  #3  0x0000555555693b2a in Map::moveCreature ([email protected]=0x55555597bd98 <g_game+24>, creature=..., newTile=..., [email protected]=false) at /media/studio/src/map.cpp:311
2022-03-06 07:53:54 -          spectator = <optimized out>
2022-03-06 07:53:54 -          __for_range = std::unordered_set with 8 elements = {[0] = 0x7fffcea39490, [1] = 0x7fffcea3cda0, [2] = 0x7fffcea38660, [3] = 0x7fffcf0a0ce0, [4] = 0x7fffcea36ee0, [5] = 0x7fffcea39940, [6] = 0x7fffcea30550, [7] = 0x7fffcea381a0}
2022-03-06 07:53:54 -          __for_begin = <optimized out>
2022-03-06 07:53:54 -          __for_end = <optimized out>
2022-03-06 07:53:54 -          oldTile = <optimized out>
2022-03-06 07:53:54 -          oldPos = {x = 32843, y = 32007, z = 7 '\a'}
2022-03-06 07:53:54 -          newPos = {x = 32843, y = 32008, z = 7 '\a'}
2022-03-06 07:53:54 -          teleport = <optimized out>
2022-03-06 07:53:54 -          list = std::unordered_set with 8 elements = {[0] = 0x7fffcea39490, [1] = 0x7fffcea3cda0, [2] = 0x7fffcea38660, [3] = 0x7fffcf0a0ce0, [4] = 0x7fffcea36ee0, [5] = 0x7fffcea39940, [6] = 0x7fffcea30550, [7] = 0x7fffcea381a0}
2022-03-06 07:53:54 -          oldStackPosVector = std::vector of length 1, capacity 1 = {1}
2022-03-06 07:53:54 -          leaf = <optimized out>
2022-03-06 07:53:54 -          new_leaf = <optimized out>
2022-03-06 07:53:54 -          i = <optimized out>
2022-03-06 07:53:54 -  #4  0x00005555555fef85 in Game::internalMoveCreature (this=0x55555597bd80 <g_game>, creature=..., toTile=..., flags=<optimized out>, [email protected]=32) at /media/studio/src/game.cpp:774
2022-03-06 07:53:54 -          ret = <optimized out>
2022-03-06 07:53:54 -          index = 2097709131
2022-03-06 07:53:54 -          toItem = 0x77d07804b0a7f07
2022-03-06 07:53:54 -          subCylinder = <optimized out>
2022-03-06 07:53:54 -          toCylinder = <optimized out>
2022-03-06 07:53:54 -          fromCylinder = <optimized out>
2022-03-06 07:53:54 -          n = <optimized out>
2022-03-06 07:53:54 -  #5  0x00005555555ffdb6 in Game::internalMoveCreature (this=<optimized out>, [email protected]=0x7fffcf0a0ce0, direction=<optimized out>, flags=32) at /media/studio/src/game.cpp:763
2022-03-06 07:53:54 -          currentPos = <optimized out>
2022-03-06 07:53:54 -          destPos = {x = <optimized out>, y = 32008, z = <optimized out>}
2022-03-06 07:53:54 -          diagonalMovement = <optimized out>
2022-03-06 07:53:54 -          toTile = <optimized out>
2022-03-06 07:53:54 -  #6  0x00005555555dca88 in Creature::onWalk (this=0x7fffcf0a0ce0) at /media/studio/src/creature.cpp:192
2022-03-06 07:53:54 -          ret = <optimized out>
2022-03-06 07:53:54 -          dir = DIRECTION_SOUTH
2022-03-06 07:53:54 -          flags = 32
2022-03-06 07:53:54 -  #7  0x00005555555ec084 in Game::checkCreatureWalk (this=0x55555597bd80 <g_game>, creatureId=<optimized out>) at /media/studio/src/game.cpp:3185
2022-03-06 07:53:54 -          creature = <optimized out>
2022-03-06 07:53:54 -  #8  0x00005555556ff0dd in std::function<void ()>::operator()() const (this=0x5555559b66e0) at /usr/include/c++/7/bits/std_function.h:706
2022-03-06 07:53:54 -  No locals.
2022-03-06 07:53:54 -  #9  Task::operator() (this=0x5555559b66d0) at /media/studio/src/tasks.h:40
2022-03-06 07:53:54 -  No locals.
 
OP
OP
Z

Zodia

Member
Joined
Feb 21, 2020
Messages
219
Reaction score
17
Thanks.
Post automatically merged:

Sorry I'm late. I sent it, but apparently it hadn't come. I zipped just in case.
 

Attachments

Last edited:

Acubens

Old Penguin
Joined
May 6, 2008
Messages
1,154
Solutions
9
Reaction score
129
Did you using any script when this happens? im not expert in c++ but this looks strange

Lua:
oldPos = {x = 32843, y = 32007, z = 7 '\a'}
newPos = {x = 32843, y = 32008, z = 7 '\a'}

C++:
#3  0x0000555555693b2a in Map::moveCreature ([email protected]=0x55555597bd98 <g_game+24>, creature=..., newTile=..., [email protected]=false) at /media/studio/src/map.cpp:311

Looks like positions isn't sent or something, lets wait some expert xD

u should add map.cpp, creature.cpp and monster.cpp too
 
Last edited:
Top