Source of null ch, perhaps

Posted by Zeno on Mon 31 May 2004 06:41 AM — 10 posts, 33,310 views.

USA #0
Finally, after a night of testing, I think I may have found the source of my null ch problem. I got this first bug:

#0  flush_buffer (d=0x8356b90, fPrompt=1 '\001') at comm.c:1281
1281            if ( xIS_SET(ch->act, PLR_BLANK) )
(gdb) bt
#0  flush_buffer (d=0x8356b90, fPrompt=1 '\001') at comm.c:1281
#1  0x080aa083 in game_loop () at comm.c:714
#2  0x080a991d in main (argc=8, argv=0xbfffda30) at comm.c:304
#3  0x42015967 in __libc_start_main () from /lib/i686/libc.so.6
(gdb) print ch
$1 = (struct char_data *) 0x0
(gdb) print ch->act
Cannot access memory at address 0xf0


This was after a hotboot, so I thought thats what it was. But after the reboot, it happened again after I attempted to re-create the issue.

Its still hard to determine the issue. Its either poison, or eating. The second crash:


#0  flush_buffer (d=0x8378c58, fPrompt=1 '\001') at comm.c:1281
1281            if ( xIS_SET(ch->act, PLR_BLANK) )
(gdb) bt
#0  flush_buffer (d=0x8378c58, fPrompt=1 '\001') at comm.c:1281
#1  0x080aa083 in game_loop () at comm.c:714
#2  0x080a991d in main (argc=2, argv=0xbfffe9d0) at comm.c:304
#3  0x42015967 in __libc_start_main () from /lib/i686/libc.so.6
(gdb) print ch
$1 = (struct char_data *) 0x0
(gdb) print d
$2 = (struct descriptor_data *) 0x8378c58


Same thing, null ch.

The full HTML color log can be found at:
http://www.dbsaga.com/zeno/nullch.html

The second time, no hotboot, so I can't be hotboot. Maybe its prompt? But I doubt it. Anyways, does it seem like its eat, or poison? Or neither? I'm finally close to solving this.

The other relating topics I had, are:
http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=4255

http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=4240

http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=4134
USA #1
Say, out of curiosity, what is the 'character update' at the beginning, there?

As far as I can tell, here are the commands you used:
who, chat, look, save, north, say, east, kill, get, eat, aff, aff by.

Also worth your time would be to look at other people's commands that may look at all people.

I'd give a careful look to the who command since that goes over the descriptors. Also look at save, even though that should be so frequent that it would be causing more problems.
USA #2
Is there anything special that happens to characters at 5th lvl? I'd also take a close look at that plr_blank flag that seems to keep poping up in your crashes.
Amended on Mon 31 May 2004 07:40 AM by Meerclar
USA #3
In the last topic I had, I posted my character update function: http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=4255

And I'm pretty sure it was the commands I did, since I got it to crash twice the exact same way. Eating a body part.

Hmm, the who command. I doubt that would make it null though.


And about the plr_blank flag, thats not very important. Its just a flag to check if they have a blank line before the prompt. Since its checking null, it crashes.
USA #4
I don't see eating a body part at the end of the log before the crash... I don't even see the command to eat a body part at the end of the log. Last command I see is get head then you get your crash message. If the act of eating a body part were the direct cause, your eating of the tongue well before the crash should have dropped the mud. I still wonder if there isn't something attempting to be done to the char at 5th level or if there isn't something with that flag that isn't referencing correctly. As for a problem with poison, unless it's a problem with poisons wearing off I'd say no since you didnt crash the first tick after you got poisoned.
Canada #5
Do you have a *nix system available? Couldn't remember what you were compiling with. If you are using a proper *nix, you might consider running it through valgrind. I have had great success finding memory leaks and overflows with this, it might help you out in this circumstance
USA #6
5th level, no, as I said before, I can re-create this crash. The first time, I wasn't level 5, I was 4.

Yeah, this is Redhat I'm using. Valgrind eh? Hmm, I don't know if that would find the problem. but I'll try.
USA #7
Try recreating the crash, narrowing down onto the bare minimum required commands each time. And you'll have to kick off the other players so that you can be sure to have a 'clean' environment. :)

If you have a memory error that's causing an overflow or something, then chances are Valgrind will find it. And regardless, chances are that it'll find all sorts of other things that you never expected but that are good to have fixed.
Canada #8
How true. I found countless leaks. I even at one point put in some code that when the mud is manually shut down, it clears out all the memory of everything. Worked pretty good, found some things like I was writing email to pfiles twice, stuff like that.

There are alot of option availbe for how to use it. I beleive that if you search for valgrind on these forums, you will be able to find a good sequence to use for how to boot with it.

If you got questions on how it works, or how to use it, just ask on here, I'm sure people can help.
USA #9
Nope, I know perfectly well how to use valgrind. Got a file in the area dir that runs it. First I'll try to re-create the crash, with the little amount of cmds possible, with no one on. Then, valgrind.