Re: [Crash] Syslog.CRASH

From: Daniel Koepke (dkoepke@california.com)
Date: 02/24/99


Kaine LaZaro wrote:

> Feb 25 22:00:04 :: SYSERR: Missed 79199 seconds worth of pulses.
> And then it crashes...

Well, you have a near-infinite loop in your code.  That is, something
in your code is taking 79,199 seconds to execute, and for code that
does synchronous multiplexing, this is a problem.  Have you added
any code that would block?  For instance, a system() call?  Or have
you added any new code that has loops?  The following code produces an
infinite loop, although the casual glance doesn't reveal the problem.

  int x = 0;
  while (x < 10);
    x++;

The semi-colon at the end of the while() statement means that the
x++ statement is not executed until the while() completes.  Since x
will always be zero, the loop never ends.  More sinister infinite
loops often lurk in for() statements for iterating through linked
lists,

  struct char_data * ch;
  for (ch = character_list; ch; ch = character_list->next)
    send_to_char("Oops.\r\n", ch);

is wrong because we mean to use ch->next, not character_list->next,
and with the way we have it, ch will never get beyond the second
character in the list, thus ch will always != NULL, and the loop
never ends.  Unfortunately, the C compiler cannot warn about this
because its difficult to predict what data will be stored where,
and probably impossible to predict it accurately.

Look for similar things.  Or if you need help, post some code to
the list that you suspect is the culprit.

-dak


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html  |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST