Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
auth_update crash
Dec 23, 2017, 10:15 pm
By Remcon
check_tumble
Dec 18, 2017, 7:21 pm
By Remcon
parse description bug
Dec 15, 2017, 10:08 pm
By Remcon
Couple bugs
Dec 12, 2017, 5:42 pm
By Remcon
Bug in disarm( )
Nov 12, 2017, 6:54 pm
By GatewaySysop
LoP 1.46
Author: Remcon
Submitted by: Remcon
LOP 1.45
Author: Remcon
Submitted by: Remcon
LOP Heroes Edition
Author: Vladaar
Submitted by: Vladaar
Heroes sound extras
Author: Vladaar
Submitted by: Vladaar
6Dragons 4.3
Author: Vladaar
Submitted by: Vladaar
Users Online
CommonCrawl, Bing, Yandex

Members: 0
Guests: 13
Stats
Files
Topics
Posts
Members
Newest Member
478
3,708
19,242
612
Jacki72H
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » Codebases » AFKMud Support & Development » SigChld Handler -- mud go BOO...
Forum Rules | Mark all | Recent Posts

SigChld Handler -- mud go BOOM!
< Newer Topic :: Older Topic > WTF?

Pages:<< prev 1 next >>
Post is unread #1 Nov 4, 2003, 8:30 pm   Last edited Nov 24, 2007, 3:30 pm by Samson
Go to the top of the page
Go to the bottom of the page

Xorith
The Null Value
GroupAFKMud Team
Posts254
JoinedFeb 23, 2003

Alright...

In effort to clean up all the nasty defunct processes, I researched a little and came up with a way to catch SigChld's. This works GREAT... except for a crash bug...

Here's the scoop:

I have a signal( SIGCHLD, SigChld ); in game_loop.

static void SigChld( int signum )
{
   int pid, status;
   DESCRIPTOR_DATA *d;
   CHAR_DATA *ch;

   while( 1 )
   {
      pid = waitpid( WAIT_ANY, &status, WNOHANG );
      if ( pid next )
      {
         if ( d->connected == CON_FORKED && d->process == pid )
         {
            if ( compilelock )
            {
               echo_to_all( AT_GREEN, "Compiler operation completed. Reboot and shutdown comm$
               compilelock = FALSE;
            }
            d->process = 0;
            d->connected = CON_PLAYING;
            fcntl( d->descriptor, F_SETFL, FNDELAY );
            ch = d->original ? d->original : d->character;
            if ( ch )
               ch_printf( ch, "Process exited with status code %d.\r\n", status );
         }
      }
   }
}


After crashing the game many times, I find this:
Tue Nov 4, 2003 11:06:02 PM CST :: [*****] BUG: Nanny: bad d->connected 13
Nanny closes my link to Xorith.
All hell breaks loose as the rest of the game treats Xorith like a mobile.

WTF?

anywho, any ideas?

-- Xorith
       
Post is unread #2 Nov 5, 2003, 2:51 am
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,639
JoinedJan 1, 2002

So this is working, or this crashes? I'm slightly confused by the fact that you mentioned on ichat that you fixed it :P

Obviously I'd prefer to have zombies rather than crashes :P
       
Post is unread #3 Nov 5, 2003, 4:18 am
Go to the top of the page
Go to the bottom of the page

Xorith
The Null Value
GroupAFKMud Team
Posts254
JoinedFeb 23, 2003

It crashes. I can't figure out why, but it seemslike it's a problem with d->connected. I don't see how or why though

-- Xorith
       
Post is unread #4 Nov 5, 2003, 5:16 am
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,639
JoinedJan 1, 2002

I haven't been able to get it to crash, but I have been able to get it to hang you indefinitely when using the grep option. What command are you using that's causing it to crash?
       
Post is unread #5 Nov 6, 2003, 3:39 am
Go to the top of the page
Go to the bottom of the page

Xorith
The Null Value
GroupAFKMud Team
Posts254
JoinedFeb 23, 2003

Oh, the hanging is because you probably didn't comment out check_forks in game_loop.

I got it to crash religiously with copysocials.


-- Xorith
       
Post is unread #6 Nov 6, 2003, 7:52 am
Go to the top of the page
Go to the bottom of the page

Samson
Black Hand
GroupAdministrators
Posts3,639
JoinedJan 1, 2002

Ah, that's just it then. I left check_forks in, and everything except grep appears to work just fine. Nothing else has hung, no crashes. It's rather wierd.
       
Post is unread #7 Nov 6, 2003, 4:29 pm
Go to the top of the page
Go to the bottom of the page

Xorith
The Null Value
GroupAFKMud Team
Posts254
JoinedFeb 23, 2003

the others will hang up if you use them in excess. I tested by spamming the commands... yeah I know - not a good idea ANYWAY, but stress-testing is one of the best ways to find bugs. :P

From what I can see... some how the character is making it into nanny() with CON_FORKED. I tried putting in a check where check_forks is, as a way to see what descriptor is CON_FORKED... this way I can set them right if they've got a process of 0.. but it doesn't work.

Next, I decide to put a case for CON_FORKED into nanny(), so it won't kill the character... I just did:

case CON_FORKED:
break;

And now it hangs up like #### when stress tested.

I think I've uncovered larger bugs though... not entirely sure really. See, after nanny bitches about d->connected being 13 (CON_FORKED), it closes the socket. This is because there's no switch case for CON_FORKED. however, what kill the game isn't this... it's other checks the game runs to maintain characters and rooms. They kill the game due to not testing for a NULL ch. While the fact is that this code shouldn't even be making the issue appear, the fact that it has appeared serves as insight to fixing these things to catch problems before they crash the game.

Alright then.

Now for this code.

WTF?

Someone *has* to have the balls to post on here besides Samson and I. ;)

-- Xorith
       
Pages:<< prev 1 next >>