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, Yandex

Members: 0
Guests: 16
Stats
Files
Topics
Posts
Members
Newest Member
478
3,708
19,242
614
BenitoVirg
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » Codebases » AFKMud Support & Development » mobile_update
Forum Rules | Mark all | Recent Posts

mobile_update
< Newer Topic :: Older Topic > Why could it crash?

Pages:<< prev 1 next >>
Post is unread #1 Sep 7, 2004, 5:25 am   Last edited Nov 18, 2007, 4:28 pm by Samson
Go to the top of the page
Go to the bottom of the page

cynshard

GroupMembers
Posts95
JoinedNov 19, 2003

I have been having lots of crashes lately that return this debugging info:

#0  0x080e477a in char_to_room (ch=0x8855a18, pRoomIndex=0x8742358) at handler.c:1305
1305            LINK( ch, pRoomIndex->first_person, pRoomIndex->last_person, next_in_room, prev_in_room );
(gdb) bt
#0  0x080e477a in char_to_room (ch=0x8855a18, pRoomIndex=0x8742358) at handler.c:1305
#1  0x08075e59 in move_char (ch=0x8855a18, pexit=0x8745e68, fall=0, direction=1, running=false) at act_move.c:1084
#2  0x08162254 in mobile_update () at update.c:1021
#3  0x08164ecd in update_handler () at update.c:2939
#4  0x080c227c in game_loop () at comm.c:4057
#5  0x080c2f37 in main (argc=6, argv=0xbffffa94) at comm.c:4534


It's always the same line, but not always the same ch. Of course it's always a mob. I'm wondering what could cause LINK to crash? both ch and pRoomIndex were valid at the time the call was made.

Here are some prints.
(gdb) print *ch
$7 = {next = 0x8855c28, prev = 0x8855808, next_in_room = 0x0, prev_in_room = 0x0, first_pet = 0x0, last_pet = 0x0,
  next_pet = 0x0, prev_pet = 0x0, master = 0x0, leader = 0x0, fighting = 0x0, hunting = 0x0, fearing = 0x0, hating = 0x0,
  morph = 0x0, reply = 0x0, switched = 0x0, mount = 0x0, pIndexData = 0x8739cf8, first_affect = 0x0, last_affect = 0x0,
  first_carrying = 0x0, last_carrying = 0x0, on = 0x0, in_room = 0x8742358, was_in_room = 0x8745de0, orig_room = 0x0,
  pcdata = 0x0, desc = 0x0, events = 0x0, first_abit = 0x0, last_abit = 0x0, last_change = 0x0, my_skyship = 0x0,
  my_rider = 0x0, on_ship = 0x0, first_timer = 0x0, last_timer = 0x0, last_cmd = 0x806fb70 ,
  prev_cmd = 0x806fb70 , spec_fun = 0, spec_funname = 0x0, mpact = 0x0, mpactnum = 0, mpscriptpos = 0,
  alloc_ptr = 0x0, substate = 0, tempnum = -9998, name = 0x8739e00 "mercenary man", short_descr = 0x8739e20 "a mercenary",
  long_descr = 0x8739e38 "A mercenary is wandering around looking for work.

", chardesc = 0x0, num_fighting = 0,
  sex = 1, Class = 3, race = 155, level = 2, trust = 0, timer = 0, wait = 1, hit = 139, max_hit = 139, hit_regen = 0,
  mana = 100, max_mana = 100, mana_regen = 0, move = 149, max_move = 150, move_regen = 0, spellfail = 101, numattacks = 2,
  amp = 0, rya = 20, exp = 452, act = {bits = {16777281, 0, 0, 0}}, affected_by = {bits = {0, 0, 0, 0}}, no_affected_by = {
    bits = {0, 0, 0, 0}}, carry_weight = 0, carry_number = 0, xflags = 2047, resistant = 0, no_resistant = 0, immune = 0,
  no_immune = 0, susceptible = 0, no_susceptible = 0, attacks = {bits = {0, 0, 0, 0}}, defenses = {bits = {0, 0, 0, 0}},
  speaks = 1, speaking = 1, saving_poison_death = 1, saving_wand = 2, saving_para_petri = 2, saving_breath = 3,
  saving_spell_staff = 3, alignment = 0, barenumdie = 3, baresizedie = 5, mobthac0 = 21, hitroll = 0, damroll = 0,
  hitplus = 130, damplus = 5, position = 12, defposition = 12, style = 0, height = 0, weight = 0, armor = 88, wimpy = 0,
  perm_str = 12, perm_int = 12, perm_wis = 16, perm_dex = 15, perm_con = 15, perm_cha = 9, perm_lck = 11, mod_str = 0,
  mod_int = 0, mod_wis = 0, mod_dex = 0, mod_con = 0, mod_cha = 0, mod_lck = 0, mental_state = 0, mobinvis = 0, absorb = 0,
  home_vnum = 26118, x = -1, y = -1, map = -1, sector = -1, has_skyship = false, inflight = false, zzzzz = 0, dcoordx = 0,
  dcoordy = 0, backtracking = false, lcoordx = 0, lcoordy = 0, heading = 0, wfavor = 0, blocked_dir = 0}


(gdb) print *pRoomIndex
$8 = {next = 0x0, first_person = 0x8854070, last_person = 0x0, first_content = 0x885d730, last_content = 0x885d730,
  first_extradesc = 0x0, last_extradesc = 0x0, area = 0x8735f80, first_exit = 0x87425e8, last_exit = 0x8742708,
  first_affect = 0x0, last_affect = 0x0, events = 0x0, mudprogs = 0x0, mpact = 0x0, mpactnum = 0, mpscriptpos = 0,
  name = 0x87423e8 "The Central Courtyard",
  roomdesc = 0x8742408 "The wide city streets converge here, the center of Vanaheim. The paved

roads stretch beyond the capabilities of the naked eye in all directions.

The streets are choked with the cities many denizens."...,
  nitedesc = 0x0, vnum = 26053, room_flags = {bits = {0, 1024, 0, 0}}, progtypes = {bits = {0, 0, 0, 0}}, light = 1,
  sector_type = 0, winter_sector = -1, tele_vnum = 0, tele_delay = 0, tunnel = 0}


Thanks

Cynshard
       
Post is unread #2 Sep 7, 2004, 9:47 am   Last edited Nov 18, 2007, 4:29 pm by Samson
Go to the top of the page
Go to the bottom of the page

cynshard

GroupMembers
Posts95
JoinedNov 19, 2003

Upon examining the LINK macro I've noticed that if first doesn't exist it sets first and last to link, but if first exists and last does not it won't hit this check. This seems to be what's happening. The question is, why is it happening? What on earth could I have done that would remove the ch from the linked list like that? Any ideas?

Cynshard

Update:

I'm fiddling with valgrind (despairation? ) and I've managed to force the crash by making mobiles that I don't see move around.

Here's what I get

Tue Sep 7, 2004 9:50:32 PM CDT :: Log Cynshard: force moron s
Tue Sep 7, 2004 9:50:37 PM CDT :: Log Cynshard: force moron n
==22211==
==22211== Invalid write of size 4
==22211==    at 0x80E71EA: char_to_room(char_data*, room_index_data*) (handler.c:1305)
==22211==    by 0x8078510: move_char(char_data*, exit_data*, int, int, bool) (act_move.c:1084)
==22211==    by 0x8078B11: do_north (act_move.c:1335)
==22211==    by 0x80FB526: interpret(char_data*, char*) (interp.c:891)
==22211==    by 0x8088324: do_force (act_wiz.c:4876)
==22211==    by 0x80FB526: interpret(char_data*, char*) (interp.c:891)
==22211==    by 0x80C4C95: game_loop() (comm.c:4030)
==22211==    by 0x80C59A4: main (comm.c:4534)
==22211==  Address 0x8 is not stack'd, malloc'd or (recently) free'd
==22211==
==22211== ---- Attach to debugger ? --- [Return/N/n/Y/y/C/c] ----


I'm not great with memory allocation/deallocation so I'm not really sure what to do...

Thanks Cynshard
       
Post is unread #3 Sep 10, 2004, 6:12 am   Last edited Nov 18, 2007, 4:29 pm by Samson
Go to the top of the page
Go to the bottom of the page

cynshard

GroupMembers
Posts95
JoinedNov 19, 2003

Well, I got a helpful thought over at gammon's forums and I decided that my get_char function should be doing a char_to_room since my quit function was doing a char_from_room. This stopped the crashes and the invisible players but now my players are getting left in limbo for some reason. I'm not sure if it's in my actual get_char2 or todo_quit functions, or if it's in the way that I call them. I'm going to post both functions for everyone's perusal. I think that with some cleaning up they might be very useful to anyone.

NOTE: I need to remove some TODO specific calls from these functions and move them too my character reading and writing functions. Namely the nullify_temp_todo() function.

/* Get Offline characters based on do_loadup --Cynshard */
CHAR_DATA* get_char2( CHAR_DATA *ch, char *argument )
{
	CHAR_DATA *temp;
	char fname[256];
	struct stat fst;
	DESCRIPTOR_DATA *d;
	ROOM_INDEX_DATA *temproom, *original = NULL;

	if( !argument || argument[0] == '�' )
  return ch;

	if( ch && ( temp = get_char_world( ch, capitalize( argument ) ) ) != NULL && !IS_NPC( temp ) )
	{
  temp->pcdata->loaded = FALSE;
  return temp;
	}

	temproom = get_room_index( ROOM_VNUM_LIMBO );
	if( !temproom )
	{
  bug( "%s", "Get_char2: Limbo room is not available!" );
  send_to_char( "Fatal error, report to the immortals.\r\n", ch );
  return NULL;
	}

	argument[0] = UPPER(argument[0]);
	snprintf( fname, 256, "%s%c/%s", PLAYER_DIR, tolower(argument[0]), capitalize( argument ) );

	/* Bug fix here provided by Senir to stop /dev/null crash */
	if ( stat( fname, &fst ) == -1 || !check_parse_name( capitalize( argument ), FALSE ) )
  return NULL;

	if( stat( fname, &fst ) != -1 )
	{
  CREATE( d, DESCRIPTOR_DATA, 1 );
  d->next = NULL;
  d->prev = NULL;
  d->connected = CON_PLOADED;
  d->outsize = 2000;
  CREATE( d->outbuf, char, d->outsize );

  // Prevent Build Log from Spamming
  getchar_flag = TRUE;

  load_char_obj( d, argument, FALSE, FALSE );

  LINK( d->character, first_char, last_char, next, prev );

  temp = d->character; // Hope this works...
  temp->pcdata->loaded = TRUE;

  original = d->character->in_room;
  if( !char_to_room( d->character, temproom ) )
  	log_printf( "char_to_room: %s:%s, line %d.", __FILE__, __FUNCTION__, __LINE__ );

  /* Save for later --Cynshard */
  temp->orig_room = original;

  d->character->desc	= NULL;
  d->character  = NULL;
  DISPOSE( d->outbuf );
  DISPOSE( d );
  return temp;
	}
	/* else no player file */
	return NULL;
}


/* A no-echo quit wrapper --Cynshard */
void todo_quit( CHAR_DATA *ch )
{
	if( ch->pcdata->loaded == FALSE || IS_CH_ONLINE( ch ) )
  return;

	int x, y;
	ROOM_INDEX_DATA *original;
	original = ch->orig_room;

	char_from_room( ch );
	if( !char_to_room( ch, original ) )
  log_printf( "char_to_room: %s:%s, line %d.", __FILE__, __FUNCTION__, __LINE__ );

	quitting_char = ch;

	nullify_temp_todo( ch );

	if( sysdata.save_pets )
	{
  CHAR_DATA *pet;

  while( ( pet = ch->last_pet ) != NULL )
  	extract_char( pet, TRUE );
	}
	saving_char = NULL;

	/*
	* After extract_char the ch is no longer valid!
	*/
	extract_char( ch, TRUE );
	for ( x = 0; x < MAX_WEAR; x++ )
  for ( y = 0; y < MAX_LAYERS; y++ )
  	save_equipment[x][y] = NULL;

	return;
}


I should probably valgrind these functions just in case. If anyone notices any memory leaks please be sure to complain to me

Thanks
Cynshard

Update:

I've started valgrinding to find obvious leaks ( I've been noticing leaky behavior ) and I'm quite puzzled by the outcome. I'm going to start another post in the coding forum about this.
       
Pages:<< prev 1 next >>