Page 1 of 2

Item Deletion Incompatability?

Posted: Tue Nov 11, 2008 6:38 pm
by nyquist
Ok, so I have finally pinpointed my segmentation fault. It occurs when I LOG OUT or ZONE; it is in a generic header file called "atomicity.h" (on my flavor of Ubuntu it lies in "/usr/include/c++/4.2/ext/").
Im running Ubuntu 8.04
EQ2Emu: Custom Build, slight tweak from SVN checked out on November 9th (maybe)
BACKTRACE #1 (for logging out)
#0 0x080aec3f in ~Item (this=0x82a91f0) at /usr/include/c++/4.2/ext/atomicity.h:51
#1 0x080aeed5 in ~PlayerItemList (this=0x82953d8) at Items.cpp:882
#2 0x08141140 in ~Player (this=0x8293d68) at Player.cpp:82
#3 0x080db186 in ~Client (this=0x85871f0) at client.cpp:158
#4 0x0815a394 in ZoneServer::ClientProcess (this=0x858d1a8) at zoneserver.cpp:1074
#5 0x081640e8 in ZoneServer::Process (this=0x858d1a8) at zoneserver.cpp:632
#6 0x08164395 in ZoneLoop (tmp=0x858d1a8) at zoneserver.cpp:2395
#7 0xb7c3a4fb in start_thread () from /lib/tls/i686/cmov/libpthread.so.0
#8 0xb7bbbe5e in clone () from /lib/tls/i686/cmov/libc.so.6
BACKTRACE #2 (whenever I zone)
#0 0x080aec3f in ~Item (this=0x82a91f0) at /usr/include/c++/4.2/ext/atomicity.h:51
#1 0x080aeed5 in ~PlayerItemList (this=0x82953d8) at Items.cpp:882
#2 0x08141140 in ~Player (this=0x8293d68) at Player.cpp:82
#3 0x080db186 in ~Client (this=0x85871f0) at client.cpp:158
#4 0x0815a394 in ZoneServer::ClientProcess (this=0x858d1a8) at zoneserver.cpp:1074
#5 0x081640e8 in ZoneServer::Process (this=0x858d1a8) at zoneserver.cpp:632
#6 0x08164395 in ZoneLoop (tmp=0x858d1a8) at zoneserver.cpp:2395
#7 0xb7c124fb in start_thread () from /lib/tls/i686/cmov/libpthread.so.0
#8 0xb7b93e5e in clone () from /lib/tls/i686/cmov/libc.so.6
The seg fault is thrown in the second line of the following code:
atomicity.h:50-51

Code: Select all

  __exchange_and_add(volatile _Atomic_word* __mem, int __val)
  { return __sync_fetch_and_add(__mem, __val);}
Which suggests that there is some problem with the atomic/mutexed operation that is going on in the final stages of the Item destructor.
If I have missed any important info...lemme know so I can post it!
(Edit made the code more clear and added full backtraces)

Posted: Tue Nov 11, 2008 9:39 pm
by John Adams
When I am messing around on Linux, LE usually asks me for the backtrace after using gdb to run the binary (I think that's it, there are other posts here of me crying about linux issues).
Maybe you can get one of those to add to your bug.

Posted: Wed Nov 12, 2008 6:46 pm
by Image
I think it is trying to save the player (to the database) after it has been deconstructed, I will be able to test it this weekend.

Posted: Thu Nov 13, 2008 12:07 am
by nyquist
I'm working on getting that back trace as soon as my test on Friday is past :)
Also, I have an update: it appears that ANY call to the Item destructor causes this same error, in the same external library, again, at the same line of code...don't know if this changes the diagnosis of the problem, but like I said, I will hopefully have that back trace by this weekend...

Posted: Fri Nov 14, 2008 8:39 am
by LethalEncounter
Could you please grab the Items.cpp file as-is from public SVN and paste the backtrace of the crash from it? The line numbers in your BTs are off and I cannot determine which line it is actually crashing on.
Thanks!

Posted: Fri Nov 14, 2008 8:41 am
by LethalEncounter
Oh one other thing. This could be caused by corrupt data. Could you also trying deleting everything from your character_items table?

Posted: Fri Nov 14, 2008 2:35 pm
by nyquist
Alrighty, well I will try updating my items; but I'm not crashing in Items.cpp....I'm actually crashing in atomicity.h. Apparently when Items.cpp is in the process of returning to its calling function (~PlayerItemList), it segfaults...
But I will humor you and go ahead and update the Items.cpp

Posted: Fri Nov 14, 2008 3:52 pm
by John Adams
Humor him?
I think if you ask for help from the dev, it is required to do as asked and not come off sounding all superior. Believe it or not, LE probably knows a little more about the code than you. Meh?
Sorry, that response just rubbed me wrong.

Posted: Fri Nov 14, 2008 4:24 pm
by Image
You should see some of the exchanges between the qa,dev,support teams at my job John :)

Posted: Sat Nov 15, 2008 11:24 am
by John Adams
Oh I imagine... that has been my profession for 10 years now, QA/Design engineer. I am usually pretty respectful to my devs, until they put on the retard cap and do something really stupid. :)

Posted: Sun Nov 16, 2008 2:46 pm
by nyquist
I didn't mean "humor you" in the way it apparently came out :P
I merely wanted to express the fact that I was not actually crashing in the area that we originally thought, but I would go ahead and complete the task (despite my further investigation)...
But, anyway, the back trace from the newest Item.cpp is as follows:

Code: Select all

#0  0x080aec72 in ~Item (this=0x82998f8) at /usr/include/c++/4.2/ext/atomicity.h:51
#1  0x080aee8a in ~PlayerItemList (this=0x82953d8) at Items.cpp:876
#2  0x08141500 in ~Player (this=0x8293d68) at Player.cpp:82
#3  0x080db546 in ~Client (this=0x85871f0) at client.cpp:158
#4  0x0815a754 in ZoneServer::ClientProcess (this=0x8592650) at zoneserver.cpp:1074
#5  0x081644a8 in ZoneServer::Process (this=0x8592650) at zoneserver.cpp:632
#6  0x08164755 in ZoneLoop (tmp=0x8592650) at zoneserver.cpp:2395
#7  0xb7bf24fb in start_thread () from /lib/tls/i686/cmov/libpthread.so.0
#8  0xb7b73e5e in clone () from /lib/tls/i686/cmov/libc.so.6
it seems the segfault is occuring in a c-plus-plus-ism in returning from the Items destructor... I no pro at C++ behind the scenes stuff....so anyone got any ideas?

Posted: Mon Nov 17, 2008 3:48 pm
by LethalEncounter
Yah no offense taken. Whenever an exception is thrown from included files outside of the project the most likely scenario is the project is causing it. In this cause I am almost certain that it is the Item destructor that is causing it. Did you ever try delete all the rows from your character_items table and seeing if it still crashed?

Posted: Mon Nov 17, 2008 10:06 pm
by John Adams
LethalEncounter wrote:Yah no offense taken
Fact: LE is a muccch nicer guy than me =)
Color me guard-dog.

Posted: Thu Nov 20, 2008 11:10 pm
by nyquist
Ok, well I noticed that despite my efforts of deleting the items present in "character_items", every time I log my character in, he gets an endless bag of envy, thus I cannot exit without an item in my inventory.
Do you happen to know where that endless bag of envy is inserted into a character's inventory? (as in which .cpp file the bag creation code is) If not I should hopefully be able to find it on my own soon...
Btw, thanks for helping me debug this problem guys

Posted: Thu Nov 20, 2008 11:46 pm
by John Adams
Check the starting_items table, by default I believe that is the only item new characters get. But once you create your toon, you should be able to delete it from character_items (your char_id) and it should not automatically return - unless there is some magic I am unaware of.