#459 crash on hailing quest npc with a stepid check

Closed
opened 1 year ago by image · 3 comments
image commented 1 year ago
0x00005555556af945 in Mutex::lock (this=this@entry=0x8) at ../common/Mutex.cpp:53
53              if (name.length() > 0) {
(gdb) bt
#0  0x00005555556af945 in Mutex::lock (this=this@entry=0x8) at ../common/Mutex.cpp:53
#1  0x00005555558d98f7 in Quest::GetQuestStep (this=0x0) at ../WorldServer/Quests.cpp:681
#2  0x000055555576b747 in Player::GetQuestStep (this=this@entry=0x6290001e5200, quest_id=<optimized out>,
    quest_id@entry=5483) at ../WorldServer/Player.cpp:5048
#3  0x00005555557d00c2 in EQ2Emu_lua_GetQuestStep (state=0x61b00100c288) at ../WorldServer/LuaFunctions.cpp:3410
#4  0x0000555555a8b380 in luaD_precall (L=0x61b00100c288, func=0x61a0196bdf40, nresults=1) at ../LUA/ldo.c:503
#5  0x0000555555aae658 in luaV_execute (L=0x61b00100c288, ci=0x60600110a620) at ../LUA/lvm.c:1615
#6  0x0000555555a8b650 in ccall (L=0x61b00100c288, func=0x61a0196bdf10, nResults=1, inc=65537) at ../LUA/ldo.c:548
#7  0x0000555555a8b6cd in luaD_callnoyield (L=0x61b00100c288, func=0x61a0196bdf10, nResults=1) at ../LUA/ldo.c:566
#8  0x0000555555ab7ddb in f_call (L=0x61b00100c288, ud=0x7fffec65a2b0) at ../LUA/lapi.c:1005
#9  0x0000555555a8a359 in luaD_rawrunprotected (L=0x61b00100c288, f=0x555555ab7da2 <f_call>, ud=0x7fffec65a2b0)
    at ../LUA/ldo.c:147
#10 0x0000555555a8be62 in luaD_pcall (L=0x61b00100c288, func=0x555555ab7da2 <f_call>, u=0x7fffec65a2b0, old_top=144, ef=0)
    at ../LUA/ldo.c:784
#11 0x0000555555ab7ebe in lua_pcallk (L=0x61b00100c288, nargs=2, nresults=1, errfunc=0, ctx=0, k=0x0) at ../LUA/lapi.c:1031
#12 0x0000555555725311 in LuaInterface::CallScriptSInt32 (this=0x61e000000080, state=0x61b00100c288,
    num_parameters=<optimized out>, returnValue=0x0) at ../WorldServer/LuaInterface.cpp:734
#13 0x000055555572b0d6 in LuaInterface::RunSpawnScript (this=this@entry=0x61e000000080,
    script_name="SpawnScripts/ForestRuins/OutlanderVaughn.lua", function_name=<optimized out>,
    function_name@entry=0x555555b128fe "hailed", npc=npc@entry=0x627001435100, spawn=spawn@entry=0x6290001e5200,
    message=message@entry=0x0, is_door_open=false, input_value=0, return_value=0x0) at ../WorldServer/LuaInterface.cpp:2304
#14 0x00005555558f96d0 in ZoneServer::CallSpawnScript (this=<optimized out>, npc=npc@entry=0x627001435100,
    type=type@entry=4 '\004', spawn=0x6290001e5200, message=message@entry=0x0, is_door_open=is_door_open@entry=false,
    input_value=0, return_value=0x0) at /usr/include/c++/9/ext/new_allocator.h:80
#15 0x000055555599bca0 in Commands::Process (this=0x555555bfd540 <commands>, index=19,
    command_parms=command_parms@entry=0x7fffec65b1a8, client=client@entry=0x61f000007080,
    targetOverride=targetOverride@entry=0x0) at ../WorldServer/Commands/../client.h:239
#16 0x000055555583e369 in Client::HandlePacket (this=0x61f000007080, app=<optimized out>) at ../WorldServer/client.cpp:1908
#17 0x0000555555846b4c in Client::Process (this=0x61f000007080, zone_process=true) at ../WorldServer/client.cpp:3128
#18 0x0000555555847583 in Client::Process (this=this@entry=0x61f000007080, zone_process=zone_process@entry=true)
    at ../WorldServer/client.cpp:3098
#19 0x0000555555929a27 in ZoneServer::ClientProcess (this=0x626000129100) at ../WorldServer/zoneserver.cpp:3308
#20 0x000055555592c4bb in ZoneServer::Process (this=0x626000129100) at ../WorldServer/zoneserver.cpp:1440
#21 0x0000555555931458 in ZoneLoop (tmp=0x626000129100) at ../WorldServer/zoneserver.cpp:7058
#22 0x00007ffff7535609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#23 0x00007ffff6f13133 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
(gdb)

``` 0x00005555556af945 in Mutex::lock (this=this@entry=0x8) at ../common/Mutex.cpp:53 53 if (name.length() > 0) { (gdb) bt #0 0x00005555556af945 in Mutex::lock (this=this@entry=0x8) at ../common/Mutex.cpp:53 #1 0x00005555558d98f7 in Quest::GetQuestStep (this=0x0) at ../WorldServer/Quests.cpp:681 #2 0x000055555576b747 in Player::GetQuestStep (this=this@entry=0x6290001e5200, quest_id=<optimized out>, quest_id@entry=5483) at ../WorldServer/Player.cpp:5048 #3 0x00005555557d00c2 in EQ2Emu_lua_GetQuestStep (state=0x61b00100c288) at ../WorldServer/LuaFunctions.cpp:3410 #4 0x0000555555a8b380 in luaD_precall (L=0x61b00100c288, func=0x61a0196bdf40, nresults=1) at ../LUA/ldo.c:503 #5 0x0000555555aae658 in luaV_execute (L=0x61b00100c288, ci=0x60600110a620) at ../LUA/lvm.c:1615 #6 0x0000555555a8b650 in ccall (L=0x61b00100c288, func=0x61a0196bdf10, nResults=1, inc=65537) at ../LUA/ldo.c:548 #7 0x0000555555a8b6cd in luaD_callnoyield (L=0x61b00100c288, func=0x61a0196bdf10, nResults=1) at ../LUA/ldo.c:566 #8 0x0000555555ab7ddb in f_call (L=0x61b00100c288, ud=0x7fffec65a2b0) at ../LUA/lapi.c:1005 #9 0x0000555555a8a359 in luaD_rawrunprotected (L=0x61b00100c288, f=0x555555ab7da2 <f_call>, ud=0x7fffec65a2b0) at ../LUA/ldo.c:147 #10 0x0000555555a8be62 in luaD_pcall (L=0x61b00100c288, func=0x555555ab7da2 <f_call>, u=0x7fffec65a2b0, old_top=144, ef=0) at ../LUA/ldo.c:784 #11 0x0000555555ab7ebe in lua_pcallk (L=0x61b00100c288, nargs=2, nresults=1, errfunc=0, ctx=0, k=0x0) at ../LUA/lapi.c:1031 #12 0x0000555555725311 in LuaInterface::CallScriptSInt32 (this=0x61e000000080, state=0x61b00100c288, num_parameters=<optimized out>, returnValue=0x0) at ../WorldServer/LuaInterface.cpp:734 #13 0x000055555572b0d6 in LuaInterface::RunSpawnScript (this=this@entry=0x61e000000080, script_name="SpawnScripts/ForestRuins/OutlanderVaughn.lua", function_name=<optimized out>, function_name@entry=0x555555b128fe "hailed", npc=npc@entry=0x627001435100, spawn=spawn@entry=0x6290001e5200, message=message@entry=0x0, is_door_open=false, input_value=0, return_value=0x0) at ../WorldServer/LuaInterface.cpp:2304 #14 0x00005555558f96d0 in ZoneServer::CallSpawnScript (this=<optimized out>, npc=npc@entry=0x627001435100, type=type@entry=4 '\004', spawn=0x6290001e5200, message=message@entry=0x0, is_door_open=is_door_open@entry=false, input_value=0, return_value=0x0) at /usr/include/c++/9/ext/new_allocator.h:80 #15 0x000055555599bca0 in Commands::Process (this=0x555555bfd540 <commands>, index=19, command_parms=command_parms@entry=0x7fffec65b1a8, client=client@entry=0x61f000007080, targetOverride=targetOverride@entry=0x0) at ../WorldServer/Commands/../client.h:239 #16 0x000055555583e369 in Client::HandlePacket (this=0x61f000007080, app=<optimized out>) at ../WorldServer/client.cpp:1908 #17 0x0000555555846b4c in Client::Process (this=0x61f000007080, zone_process=true) at ../WorldServer/client.cpp:3128 #18 0x0000555555847583 in Client::Process (this=this@entry=0x61f000007080, zone_process=zone_process@entry=true) at ../WorldServer/client.cpp:3098 #19 0x0000555555929a27 in ZoneServer::ClientProcess (this=0x626000129100) at ../WorldServer/zoneserver.cpp:3308 #20 0x000055555592c4bb in ZoneServer::Process (this=0x626000129100) at ../WorldServer/zoneserver.cpp:1440 #21 0x0000555555931458 in ZoneLoop (tmp=0x626000129100) at ../WorldServer/zoneserver.cpp:7058 #22 0x00007ffff7535609 in start_thread (arg=<optimized out>) at pthread_create.c:477 #23 0x00007ffff6f13133 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95 (gdb) ```
image commented 1 year ago
Collaborator

This is probably because I modified the hailed message to instantly offer the quest and then it checks the step shortly after

function hailed(NPC, Spawn)
  OfferQuest(NPC, Spawn, 5483) -- offers quest just by hailing
    FaceTarget(NPC, Spawn)
    conversation = CreateConversation()
if not HasCompletedQuest(Spawn, 5483) and not HasQuest(Spawn, 5483) then
    PlayFlavor(NPC, "voiceover/english/outlander_vaughn/qey_adv02_ruins/quests/outlander_dakota/outlander_dakota.mp3", "", "facepalm", 2613853514, 75460760, Spawn)

        if GetLevel(Spawn)>=6 then
        AddConversationOption(conversation, "What is it you need?", "dlg_4_1")
        end
        AddConversationOption(conversation, "No time for charity. ")
        StartConversation(conversation, NPC, Spawn, "Am I ever in a bind! Will you please help me?")
elseif HasQuest(Spawn, 5483) then
        PlayFlavor(NPC, "voiceover/english/outlander_vaughn/qey_adv02_ruins/quests/outlander_dakota/outlander_dakota001.mp3", "", "", 2350706866, 1692101884, Spawn)
        if GetQuestStep (Spawn,5483)== 5 then -- we check a quest step based on the quest id 5483
        AddConversationOption(conversation, "Here are your things you were looking for.", "HandIn")
        end         
        AddConversationOption(conversation, "I'm working on it.", "dlg_1_1")
        StartConversation(conversation, NPC, Spawn, "I thought you said you'd  help me!  Do what you can, okay?")


elseif  HasCompletedQuest(Spawn, 5483) and not HasCompletedQuest(Spawn, 5484) then
        FaceTarget(NPC, Spawn)
    conversation = CreateConversation()

    PlayFlavor(NPC, "voiceover/english/outlander_vaughn/qey_adv02_ruins/quests/outlander_dakota/outlander_dakota003.mp3", "", "thank", 3067693779, 1933175006, Spawn)
        AddConversationOption(conversation, "What else do you need?","Letter")
        AddConversationOption(conversation, "I don't have the time, sorry. ")
    StartConversation(conversation, NPC, Spawn, "Thank you so very much for finding my dear possessions! Can you help me with one more small favor?")
    
else
    PlayFlavor(NPC, "", "Be careful around these ruins. The nights bring out some of the magic in this place.", "hello", 0, 0, Spawn)

    end
end
This is probably because I modified the hailed message to instantly offer the quest and then it checks the step shortly after ``` function hailed(NPC, Spawn) OfferQuest(NPC, Spawn, 5483) -- offers quest just by hailing FaceTarget(NPC, Spawn) conversation = CreateConversation() if not HasCompletedQuest(Spawn, 5483) and not HasQuest(Spawn, 5483) then PlayFlavor(NPC, "voiceover/english/outlander_vaughn/qey_adv02_ruins/quests/outlander_dakota/outlander_dakota.mp3", "", "facepalm", 2613853514, 75460760, Spawn) if GetLevel(Spawn)>=6 then AddConversationOption(conversation, "What is it you need?", "dlg_4_1") end AddConversationOption(conversation, "No time for charity. ") StartConversation(conversation, NPC, Spawn, "Am I ever in a bind! Will you please help me?") elseif HasQuest(Spawn, 5483) then PlayFlavor(NPC, "voiceover/english/outlander_vaughn/qey_adv02_ruins/quests/outlander_dakota/outlander_dakota001.mp3", "", "", 2350706866, 1692101884, Spawn) if GetQuestStep (Spawn,5483)== 5 then -- we check a quest step based on the quest id 5483 AddConversationOption(conversation, "Here are your things you were looking for.", "HandIn") end AddConversationOption(conversation, "I'm working on it.", "dlg_1_1") StartConversation(conversation, NPC, Spawn, "I thought you said you'd help me! Do what you can, okay?") elseif HasCompletedQuest(Spawn, 5483) and not HasCompletedQuest(Spawn, 5484) then FaceTarget(NPC, Spawn) conversation = CreateConversation() PlayFlavor(NPC, "voiceover/english/outlander_vaughn/qey_adv02_ruins/quests/outlander_dakota/outlander_dakota003.mp3", "", "thank", 3067693779, 1933175006, Spawn) AddConversationOption(conversation, "What else do you need?","Letter") AddConversationOption(conversation, "I don't have the time, sorry. ") StartConversation(conversation, NPC, Spawn, "Thank you so very much for finding my dear possessions! Can you help me with one more small favor?") else PlayFlavor(NPC, "", "Be careful around these ruins. The nights bring out some of the magic in this place.", "hello", 0, 0, Spawn) end end ```
image commented 1 year ago
Collaborator

#2 0x000055555576b747 in Player::GetQuestStep (this=this@entry=0x6290001e5200, quest_id=,

is getting a null check for the quest ptr, it seems despite our locking we may still somehow remove the quest and just leave a null pointer in its place within the map

#2 0x000055555576b747 in Player::GetQuestStep (this=this@entry=0x6290001e5200, quest_id=<optimized out>, is getting a null check for the quest ptr, it seems despite our locking we may still somehow remove the quest and just leave a null pointer in its place within the map
image commented 1 year ago
Collaborator

this was fixed as part of 60928d2e0c

this was fixed as part of https://git.eq2emu.com/devn00b/EQ2EMu/commit/60928d2e0cc3c59da31847668b41a681e727acd5
Sign in to join this conversation.
Loading...
Cancel
Save
There is no content yet.