Re: Infinite Loops

From: Alex (fletchra@qsilver.queensu.ca)
Date: 05/01/00


> Seems to me that this would only catch near-infinite loops. Since an
> infinite loop lasts forever, the timer in comm.c will never be reached.
Since it is a signal that gets setup, an alarm signal is set to go off
every 3 minutes (or thereabouts).  As such, if the timer isn't being
updated when the alarm goes, the mud assumes that it is in an infinite
loop and exits.

The key is figuring out where this infinite loop is.  To do that, you
can try to force the game to dump core and then backtrace through stuff
until you find the routine that was broken out of to raise the signal.
Some systems will let 'abort()' dump core, in others, you might have to
try doing it manually.

I've found that abort() does not work terribly consistently for me, but
the following routine drops a core dump every time:

void dump_core(void)
{
  char buf[10];

  /* If we return from this, we have some _hefty_ issues */
  free((char *) 1);
  free(buf);
  free(buf);
  if (((struct char_data *)(long)time(0))->in_room)
    diku_shutdown = 0;
  /* Let's hope that's enough to core dump  ;-) */
}

Of course, YMMV.

Ae.


     +------------------------------------------------------------+
     | 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 : 04/10/01 PDT