MOO-cows Mailing List Archive

[Prev][Next][Index][Thread]

out of memory panics





We're getting frequent panics from lack of memory:

Jun  8 20:35:27: CHECKPOINTING on moose.db.new.#51# ...
Jun  8 20:36:20: *** PANIC (in child): memory allocation (size 81920) failed!
Jun  8 20:36:20: *** Child shutting down parent via USR1 signal
Jun  8 20:36:20: SHUTDOWN: shutdown signal received
Jun  8 20:36:20: Closing transcript file...Jun  8 20:36:20: successful
Jun  8 20:36:20: DUMPING on moose.db.new.#52# ...
Jun  8 20:37:12: *** PANIC: memory allocation (size 81920) failed!
Jun  8 20:37:12: PANIC-DUMPING on moose.db.new.PANIC ...
Jun  8 20:38:01: *** PANIC: memory allocation (size 32) failed!
Jun  8 20:38:01: *** RECURSIVE PANIC: aborting

We're running (sorry Pavel, I know you don't want to hear bug reports
from the old version) MOO 1.7.9p2.  The core file from this particular
crash was bad (it just said 'fatal error' when I tried to open it with dbx).
Our machine is a Dec Alpha running OSF/1 V3.2A.  The machine has
196 Mb of RAM and 500 Mb of swap space.  The db is only 27 Mb.  It's
taking up 133 Mb when it's first loaded into memory.  As far as I can
tell (I'm not positive) no one was logged on when this crash occurred.

Question 1: 
When it says allocation size 81920 failed, what are the units?
Is that bytes or kb or...?

Question 2: 
My first guess is that the problem is being caused by our server mods.
These were written by a student who has since moved on to other things
(and other continents).  A copy of the mods is attached.  How do these
look to you folks?  Is there something that could be causing these
crashes?

Caveat 1:
Yes, we are recording everything on the system--that's what the server mods
I'm worried about do.  But everyone participating is very aware of this fact.
You have to sign a form saying you understand that and send it to me via fax
or surface mail before you can participate.  There is no guest access.


Thanks for your help!

-- Amy




The following are the mods made to server.c in version 1.7.9p2 to
implement tranascripting:

Builtins are added by a procedure pointed to by the README file.

after #includes at top of server.c
----------------------------------

#include "execute.h"

/* ** start transcript mod ** */
void open_new_transcript_file (void);
void close_transcript_file (void);
void transcript_write_notify (Objid player, const char *message);
void transcript_write_read (int player, const char *message);
/* ** end transcript mod ** */

static pid_t		parent_pid;
int			in_child = 0;



main()
------

    parent_pid = getpid();
    setup_signals();
    reset_command_history();
    build_preptable();
    
    /* ** transcript mod start ** */
    open_new_transcript_file();
    /* ** transcript mod end ** */

    main_loop();

    /* ** transcript mod start ** */
    close_transcript_file();
    /* ** transcript mod end ** */

    network_shutdown();
    db_shutdown();




main_loop(void)
---------------

	if (checkpoint_requested != CHKPT_OFF) {

	  /* ** start transcript mods ** */
	  close_transcript_file();
	  open_new_transcript_file();
	  /* ** end transcript mods ** */

	    if (checkpoint_requested == CHKPT_SIGNAL)
		log("CHECKPOINTING due to remote request signal.\n");




server_recieve_line
-------------------

void
server_receive_line(server_handle sh, const char *line)
{
    shandle    *h = (shandle *) sh.ptr;

    /* ** start transcript mods ** */
    transcript_write_read(h->player, line);
    /* ** end transcript mods ** */

    h->last_activity_time = time(0);
    enqueue_input_task(h->tasks, line);
}



bf_notify
------

    r.type = TYPE_NUM;
    if (h && !h->disconnect_me)

      /* ** start transcript mods ** */
      {
        transcript_write_notify(conn, line);
         /* ** end transcript mods ** */

         r.v.num = network_send_line(h->nhandle, line, !no_flush);

         /* ** start transcript mods ** */
       }
    /* ** end transcript mods** */

    else {
        if (in_emergency_mode)
            emergency_notify(conn, line);



Add the following code to bf_moosemods.c:
-----------------------------------------
(don't forget to modify other stuff to include bf_moosemods as 
outlined in functions.c--there should be more info in MAKEFILE 
on this as well)--need changes to functions.c, Makefile, bf_register.h


--we shouldn't need to make these changes to bf_moosemods.c if we
just use the latest version, right?


#define TRANSCRIPT_FILE   "/usr/local/MOOSE_transcripts/transcript"

FILE *transcriptFile;

void
open_new_transcript_file(void)
{
  char *funkyname;
  time_t now = time(0);
  char *datestring[255];
  char longname[255];
  

  funkyname = TRANSCRIPT_FILE;
  strftime(datestring, 80, "%b.%d.%y-%H:%M\n", localtime(&now));

  strcpy(longname, funkyname);
  strncat(longname, datestring, (strlen(datestring) - 1));

  transcriptFile = fopen (longname, "w");
    
  log("Opening transcript file named: %s\n", longname);
}

void
close_transcript_file(void)
{
    log("Closing transcript file...");
    if (fclose (transcriptFile) == 0)
      log ("successful\n");
    else
      log ("failed\n");
}

void
transcript_write_notify(Objid player, const char *message)
{
  time_t now;
  char *dtime;
  struct tm *date;

  time(&now);
  dtime = ctime(&now);
  date = localtime(&now) ;
  strftime(dtime, 80, "%m/%d/%y %H:%M:%S", date);

  fprintf(transcriptFile, "%s #%-5d << %s \n", dtime, (int) player, message);
}

void
transcript_write_read(int player, const char *message)
{
  time_t now;
  char *dtime;
  struct tm *date;

  if (player > 0) {

  time(&now);
  dtime = ctime(&now);
  date = localtime(&now) ;
  strftime(dtime, 8, "%H:%M:%S", date);    strftime(dtime, 80, "%H:%M:%S", date);
  
    fprintf(transcriptFile, "%s #%-5d #%-5d >>>> %s \n", dtime, (int) retrieve(player)->location, (int) p
layer, message);
  }
}













Follow-Ups:

Home | Subject Index | Thread Index