MOO-cows Mailing List Archive

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

declaring prop on #1 crashes server




This is reproducable: 
declaring a new property on #1 crashes our server

We are running 1.8.0p5 with some server mods that are attached bellow.
Our machine is a Dec AlphaStation 250 4/266 running OSF/1 V3.2
We have 192 Mb of physical RAM and 650 Mb of swap space.
The process takes up 134 Mb on booting, and that's what it was
taking up when the server crashed.

Here's the log:
Fri Jun 14 10:21:56 EDT 1996: RESTARTED
Jun 14 10:21:56: STARTING: Version 1.8.0p5 of the LambdaMOO server
Jun 14 10:21:56:           (Using BSD/TCP protocol)
Jun 14 10:21:56:           (Task timeouts measured in server CPU seconds.)
Jun 14 10:21:56: LOADING: moose.db
Jun 14 10:21:56: NAME_LOOKUP: Started new lookup process
Jun 14 10:21:56: LOADING: Reading 1212 objects...
Jun 14 10:22:44: LOADING: Done reading 1212 objects ...
Jun 14 10:22:44: VALIDATING the object hierarchies ...
Jun 14 10:22:44: VALIDATE: Phase 1: Check for invalid objects ...
Jun 14 10:22:44: VALIDATE: Phase 2: Check for cycles ...
Jun 14 10:22:44: VALIDATE: Phase 3: Check for inconsistencies ...
Jun 14 10:22:44: VALIDATING the object hierarchies ... finished.
Jun 14 10:22:44: LOADING: Reading 2986 MOO verb programs...
Jun 14 10:23:01: LOADING: Done reading 2986 verb programs...
Jun 14 10:23:01: LOADING: Reading forked and suspended tasks...
Jun 14 10:23:01: LOADING: Reading list of formerly active connections...
Jun 14 10:23:01: LOADING: moose.db done, will dump new database on moose.db.new
Jun 14 10:23:01: LISTEN: #0 now listening on port 7777
Jun 14 10:34:29: ACCEPT: #-2 on port 7777 from onala.media.mit.edu, port 2052
Jun 14 10:34:32: CONNECTED: Austina (#577) on port 7777 from onala.media.mit.edu
, port 2052
Jun 14 10:34:44: ACCEPT: #-3 on port 7777 from onala.media.mit.edu, port 2053
Jun 14 10:34:49: CONNECTED: Kristina (#686) on port 7777 from onala.media.mit.ed
u, port 2053
Jun 14 10:35:05: ACCEPT: #-4 on port 7777 from onala.media.mit.edu, port 2054
Jun 14 10:35:08: CONNECTED: Fish (#684) on port 7777 from onala.media.mit.edu, p
ort 2054
Jun 14 10:43:35: *** PANIC: memory allocation (size 6768) failed!
Jun 14 10:43:35: *** PANIC: memory allocation (size 10240) failed!
Jun 14 10:43:35: *** RECURSIVE PANIC: aborting

Here's the output from the core file:
dbx version 3.11.8
Type 'help' for help.
Core file created by program "moo"

signal IOT/Abort trap at   [__kill:41 +0x8,0x3ff801072d8]        Source not available
(dbx) where
>  0 __kill(0x131c17a97, 0x3ffc00804a0, 0x140004ab0, 0x11fffda70, 0x3ff800df50c) ["../../../../../src/usr/ccs/lib/libc/alpha/kill.s":41, 0x3ff801072d8]
   1 raise(0x6, 0x147f17b80, 0x147f2ef40, 0x10, 0x1c0) ["../../../../../src/usr/ccs/lib/libc/raise.c":87, 0x3ff8011bbe0]
   2 abort(0x14, 0x0, 0x140004ab0, 0x0, 0x0) ["../../../../../src/usr/ccs/lib/libc/abort.c":131, 0x3ff8010a050]
   3 abort_server(0x140004ab0, 0x0, 0x0, 0xfffffc0000000000, 0x120040a14) ["server.c":204, 0x12004097c]
   4 panic(0x0, 0xfffffc0000000000, 0x120040a14, 0x5, 0x1200458d0) ["server.c":215, 0x120040a10]
   5 mymalloc(0x3ff00002800, 0x0, 0x100000020, 0x1, 0x12003c3b0) ["storage.c":50, 0x1200458cc]
   6 allocate(0x18, 0x1, 0x20, 0x1, 0x0) ["ast.c":69, 0x12000b454]
   7 alloc_arg_list(0x0, 0x147f17b80, 0x100000002, 0x0, 0x12001850c) ["ast.c":203, 0x12000b9c0]
   8 decompile(0x101010102, 0x143d899a0, 0xd000005df, 0x0, 0x143d89b26) ["decompile.c":496, 0x120018518]
   9 decompile(0x101010102, 0x143d899a0, 0xd000005df, 0xa, 0x143d89f7f) ["decompile.c":180, 0x120016b34]
  10 program_to_tree(0x100000018, 0xffffffffffffffff, 0x3ff00000064, 0xd, 0x12002fcf4) ["decompile.c":841, 0x120019eb4]
11 find_line_number(0x147c23ae0, 0x14000260e, 0x2ae, 0x1417985c3, 0x3ffc0088e80) ["decompile.c":966, 0x12001a2a0]
  12 print_error_backtrace(0x140004b68, 0x12001c650, 0x11fffe5d0, 0x1400054aa, 0x1400054b3) ["execute.c":97, 0x12001c4ec]
  13 panic(0x11fffe5d0, 0x1400054aa, 0x1400054b3, 0x6, 0x1200458d0) ["server.c":227, 0x120040a9c]
  14 mymalloc(0x100001a70, 0x3, 0x120013048, 0x2b6, 0x119) ["storage.c":50, 0x1200458cc]
  15 insert_prop(0x2b6, 0x100000119, 0x100000000, 0x5, 0x5000002ae) ["db_properties.c":83, 0x12001306c]
  16 insert_prop_recursively(0x6e, 0x100000119, 0x100000000, 0x5, 0x5000002ae) ["db_properties.c":108, 0x120013414]
  17 insert_prop_recursively(0x3, 0x100000105, 0x100000000, 0x5, 0x5000002ae) ["db_properties.c":116, 0x120013470]
  18 insert_prop_recursively(0x1, 0xef, 0x100000000, 0x5, 0x5000002ae) ["db_properties.c":116, 0x120013470]
  19 insert_prop_recursively(0x11fffe8b0, 0x147f06f80, 0x100000000, 0x5, 0x5000002ae) ["db_properties.c":116, 0x120013470]
  20 db_add_propdef(0x1, 0x147f06f80, 0x100000000, 0x0, 0x2ae) ["db_properties.c":155, 0x1200136b4]
  21 bf_add_prop(0x11fffede0, 0x147e7ce00, 0x100000004, 0x1, 0x0) ["property.c":209, 0x12003b748]
  22 call_bi_func(0x11fffede0, 0x1448665c0, 0x147e7ce00, 0x100000004, 0x1) ["functions.c":252, 0x12002a87c]
  23 run(0x120047470, 0x11ffff6a0, 0x120051520, 0x11ffffcb6, 0x120047f90) ["execute.c":1535, 0x120024c5c]
  24 run_interpreter(0x0, 0x11ffff6a0, 0x120045920, 0x1, 0x147f017e0) ["execute.c":1896, 0x120026f68]
  25 do_task(0x1479a23a0, 0xffffffff, 0x11ffff6a0, 0x1, 0x147f017e0) ["execute.c":1988, 0x120027374]
26 do_server_program_task(0x0, 0x140005a80, 0x147f27100, 0x100000004, 0x0) ["execute.c":2065, 0x120027958]
  27 do_server_verb_task(0x0, 0x140005a80, 0x147f27100, 0x100000004, 0x14000ec20) ["execute.c":2025, 0x120027624]
  28 run_server_task_setting_id(0x2ae, 0x0, 0x140005a80, 0x147f27100, 0x100000004) ["tasks.c":1098, 0x120048f84]
  29 do_command_task(0x147e89dc0, 0x1448741a0, 0x120046fa8, 0x147f2bc80, 0x120048db8) ["tasks.c":504, 0x1200476f4]
  30 run_ready_tasks(0x0, 0x40, 0x120041620, 0xbab1, 0x120041658) ["tasks.c":1027, 0x120048cb0]
  31 main_loop(0x14001a850, 0x140027140, 0x3ffc0088e80, 0x147f36080, 0x4) ["server.c":496, 0x120041664]
  32 main(0x0, 0x11ffffaa0, 0x12000b25c, 0x12000b1b0, 0x3ff00000000) ["server.c":1280, 0x120043c2c]
(dbx) 


Here are our server mods:
The following are the mods made to server.c in version 1.8.0p5 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();

    if (!emergency  ||  emergency_mode()) {
        if (!start_listener(l))
            exit(1);
    
    /* ** 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 ** */

      if (h->binary) {
            int length;



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?

#include "my-string.h"
#include "bf_register.h"
#include "config.h"
#include "exceptions.h"
#include "functions.h"
#include "options.h"
#include "ref_count.h"
#include "storage.h"
#include "structures.h"
#include "unparse.h"
#include "utils.h"
#include "time.h"

/* number 20 hardcoded in from $table_utils.max_hash_chars */
#define MAX_HASH_CHARS 20
#define HASH_CONSTANT  65599
#define TRANSCRIPT_FILE   "/usr/local/MOOSE_transcripts/transcript"

static package
bf_hash(Var arglist, Byte next, void *vdata, Objid prog)
{
  Var r;
  char *key;
  int32 table_size;
  int length;
  int x, y;
  int result=0;

  r.type = TYPE_INT;

  key = (char*) arglist.v.list[1].v.str;
  table_size = arglist.v.list[2].v.num;

  length = strlen(key);

  length = (length > MAX_HASH_CHARS) ? MAX_HASH_CHARS : length;
  for (x=0; x< length; x++)
    {
      /*  Use temp integer y to make the key case insensitive.
	  Every lowercase letter is converted to an uppercase letter.
	  Other characters are unchanged.  DBQ
	  */
      y = key[x];
      if((y >= 'a') && (y <= 'z')) y += 'A' - 'a';

      result += HASH_CONSTANT * y;
      result = 1 + result % table_size;
    }

  r.v.num = result;
  free_var(arglist);
  return make_var_pack(r);
}

static package
bf_toascii(Var arglist, Byte next, void *vdata, Objid prog)
{
    Var r;
    if (strlen(arglist.v.list[1].v.str) != 1)
      {
	free_var(arglist);
	return make_error_pack(E_INVARG);
      }
    r.type = TYPE_INT;
    r.v.num = arglist.v.list[1].v.str[0];
    free_var(arglist);
    return make_var_pack(r);
}

static package
bf_chrtonum(Var arglist, Byte next, void *vdata, Objid prog)
{
    Var r;
    if (strlen(arglist.v.list[1].v.str) != 1)
      {
	free_var(arglist);
	return make_error_pack(E_INVARG);
      }
    r.type = TYPE_INT;
    if (arglist.v.list[1].v.str[0] > 96)
      r.v.num = arglist.v.list[1].v.str[0] - 32;
    else
      r.v.num = arglist.v.list[1].v.str[0];
    free_var(arglist);
    return make_var_pack(r);
}


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");
  
  logf("Opening transcript file named: %s\n", longname);
}

void
close_transcript_file(void)
{
    logf("Closing transcript file...");
    if (fclose (transcriptFile) == 0)
      logf("successful\n");
    else
      logf("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, "%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, 80, "%H:%M:%S", date);
  
    fprintf(transcriptFile, "%s #%-5d #%-5d >>>> %s \n", dtime, (int) db_object_location(player), (int) player, message);

  }
}

void
register_moosemods(void)
{
    (void) register_function("toascii", 1, 1, bf_toascii, TYPE_STR);
    (void) register_function("chrtonum", 1, 1, bf_chrtonum, TYPE_STR);
    (void) register_function("hash", 2, 2, bf_hash, TYPE_STR, TYPE_INT);
}



(This isn't the same crash as the one I sent to some folks earlier this
morning... it's a second one.)

Thanks for your help!

-- Amy


Follow-Ups:

Home | Subject Index | Thread Index