Page 1 of 1

[Fixed] reload quests crashing server

Posted: Sun Dec 03, 2017 8:18 pm
by Cynnar
Found another one (local not tested on eq2emulator server) when reloading quest.
Collections.cpp

Code: Select all

	for (itr = collection_items.begin(); itr != collection_items.end(); itr++) {
		collection_item = *itr;
		if (collection_item->item->details.item_id == item->details.item_id) {
			if (collection_item->found)
				return false;
			else
				return true;
		}
	}
if (collection_item->item->details.item_id == item->details.item_id) {
Unhandled exception thrown: read access violation.
collection_item->item was 0x132D79F0.
From the Call Stack window

Code: Select all

>	EQ2World_x64.exe!Collection::NeedsItem(Item * item) Line 124	C++	Symbols loaded.
 	EQ2World_x64.exe!PlayerCollectionList::NeedsItem(Item * item) Line 297	C++	Symbols loaded.
 	EQ2World_x64.exe!Item::serialize(PacketStruct * packet, bool show_name, Player * player, unsigned short packet_type, unsigned char subtype, bool loot_item) Line 1988	C++	Symbols loaded.
 	EQ2World_x64.exe!PacketStruct::setItem(DataStruct * ds, Item * item, Player * player, unsigned int index, char offset) Line 2374	C++	Symbols loaded.
 	EQ2World_x64.exe!PacketStruct::setItemArrayDataByName(const char * name, Item * item, Player * player, unsigned int index1, unsigned int index2, char offset) Line 2409	C++	Symbols loaded.
 	EQ2World_x64.exe!Quest::QuestJournalReply(unsigned short version, unsigned int player_crc, Player * player, QuestStep * updateStep, unsigned char update_count, bool old_completed_quest, bool quest_failure, bool display_quest_helper) Line 1233	C++	Symbols loaded.
 	EQ2World_x64.exe!Client::AddPlayerQuest(Quest * quest, bool call_accepted, bool send_packets) Line 4257	C++	Symbols loaded.
 	EQ2World_x64.exe!Client::ReloadQuests() Line 4384	C++	Symbols loaded.
 	EQ2World_x64.exe!ZoneServer::ReloadClientQuests() Line 3825	C++	Symbols loaded.
 	EQ2World_x64.exe!ZoneList::ReloadClientQuests() Line 711	C++	Symbols loaded.
 	EQ2World_x64.exe!Commands::Process(unsigned int index, EQ2_16BitString * command_parms, Client * client) Line 1034	C++	Symbols loaded.
 	EQ2World_x64.exe!Client::HandlePacket(EQApplicationPacket * app) Line 1504	C++	Symbols loaded.
 	EQ2World_x64.exe!Client::Process(bool zone_process) Line 2400	C++	Symbols loaded.
 	EQ2World_x64.exe!ZoneServer::ClientProcess() Line 2903	C++	Symbols loaded.
 	EQ2World_x64.exe!ZoneServer::Process() Line 1362	C++	Symbols loaded.
 	EQ2World_x64.exe!ZoneLoop(void * tmp) Line 6006	C++	Symbols loaded.
 	[Inline Frame] EQ2World_x64.exe!invoke_thread_procedure(void(*)(void *)) Line 82	C++	Symbols loaded.
 	EQ2World_x64.exe!thread_start<void (__cdecl*)(void * __ptr64)>(void * const parameter) Line 115	C++	Symbols loaded.
 	[External Code]		Annotated Frame

and from the Autos window

Code: Select all

+		*itr	0x000000002348c330 {item=0x00000000132d79f0 {lowername={...} name={...} description={...} ...} index=...}	CollectionItem * &
+		collection_item	0x000000002348c330 {item=0x00000000132d79f0 {lowername={...} name={...} description={...} ...} index=...}	CollectionItem *
+		collection_item->item	0x00000000132d79f0 {lowername={...} name={...} description={...} ...}	Item *
+		collection_item->item->details	{item_id=??? soe_id=??? bag_id=??? ...}	ItemCore
+		collection_items	{ size=7 }	std::vector<CollectionItem *,std::allocator<CollectionItem *> >
+		item	0x000000000d274e90 {lowername="handbook of the ravens of the north" name="Handbook of the Ravens of the North" ...}	Item *
+		item->details	{item_id=21180 soe_id=1016620818 bag_id=0 ...}	ItemCore
		item->details.item_id	21180	unsigned int
+		itr	{0x000000002348c330 {item=0x00000000132d79f0 {lowername={...} name={...} description={...} ...} index=...}}	std::_Vector_iterator<std::_Vector_val<std::_Simple_types<CollectionItem *> > >
+		this	0x0000000003250250 {id=71 name=0x000000000325025c "Chokidai Collars" category=0x000000000325045c "Kunark" ...}	Collection *
Forgive my debugging skills and lack of what I need to post. If there is anything else I need to provide let me know.

Just tested again and this happesn after I reload items then reload quests.

Re: reload quests crashing server

Posted: Mon Dec 04, 2017 5:32 pm
by Jabantiz
So basically what is happening here is collection_item is a struct with a pointer to an item in the master_item_list. Once a "/reload items" is used those pointers are no longer valid but remain so when the collection does its loop it errors out on an invalid pointer.

I am going over the code to see if we really need an item pointer or if we can make do with just an item id which would be preferable.

Re: reload quests crashing server

Posted: Mon Dec 04, 2017 6:50 pm
by Jabantiz
Did a quick test after my changes and no crahes. Just pushed the code to Dev SVN.