crash when new max player happens.

Posted by Robert Powell on Fri 06 Jun 2008 12:04 PM — 4 posts, 18,136 views.

Australia #0
I have this weird crash whenever i have a new max player, for now i have set maxplayer in sysdata.dat to be 1000, more than will ever connect and it does not crash no matter how many i connect.

backtrace:

#0 0xb7ef97a2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2
#1 0xb7d947a5 in raise () from /lib/tls/libc.so.6
#2 0xb7d96209 in abort () from /lib/tls/libc.so.6
#3 0xb7dc8a1a in __libc_message () from /lib/tls/libc.so.6
#4 0xb7dcf2bf in _int_free () from /lib/tls/libc.so.6
#5 0xb7dcf63a in free () from /lib/tls/libc.so.6
#6 0xb7dbfa46 in fclose@@GLIBC_2.1 () from /lib/tls/libc.so.6
#7 0x080e8305 in save_sysdata (sys=
{maxplayers = 16, alltimemax = 16, global_looted = 0, upill_val = 0, upotion_val = 0, brewed_used = 0, scribed_used = 0, time_of_max = 0x9c5e698 "Fri Jun 6 07:49:10 2008", mud_name = 0x9c5e688 "EldhaMUD", NO_NAME_RESOLVING = 1 '\001', DENY_NEW_PLAYERS = 0 '\0', WAIT_FOR_AUTH = 0 '\0', read_all_mail = 38, read_mail_free = 31, write_mail_free = 31, take_others_mail = 38, muse_level = 36, think_level = 40, build_level = 33, log_level = 33, level_modify_proto = 35, level_override_private = 44, level_mset_player = 36, bash_plr_vs_plr = 10, bash_nontank = 10, gouge_plr_vs_plr = 10, gouge_nontank = 15, stun_plr_vs_plr = 20, stun_regular = 7, dodge_mod = 2, parry_mod = 2, tumble_mod = 4, dam_plr_vs_plr = 50, dam_plr_vs_mob = 100, dam_mob_vs_plr = 75, dam_mob_vs_mob = 100, level_getobjnotake = 39, level_forcepc = 36, bestow_dif = 10, max_sn = 0, guild_overseer = 0x9c5e6c0 "", guild_advisor = 0x9c5e6c0 "", save_flags = 1957, save_frequency = 10, morph_opt = 1, save_pets = 1, ban_site_level = 31, ban_Class_level = 31, ban_race_level = 31, ident_retries = 20, pk_loot = 0, newbie_purge = 30, regular_purge = 180, CLEANPFILES = 1 '\001', dlHandle = 0xb7f104f8}) at db.c:5389
#8 0x080d1416 in new_descriptor (new_desc=5) at comm.c:781
#9 0x080d06ce in accept_new (ctrl=5) at comm.c:400
#10 0x080d0725 in game_loop () at comm.c:422
#11 0x080d014f in main (argc=6, argv=0xbfc4ce74) at comm.c:200


from frame 7:

5384    void save_sysdata( SYSTEM_DATA sys )
5385    {
5386      FILE *fp;
5387      char filename[MAX_INPUT_LENGTH];
5388      sprintf( filename, "%ssysdata.dat", SYSTEM_DIR );
5389      fclose( fpReserve );
5390      if ( ( fp = fopen( filename, "w" ) ) == NULL )
5391        {
5392          bug( "save_sysdata: fopen" );
5393          perror( filename );
(gdb) list
5394        }
5395      else
5396        {
5397          fprintf( fp, "#SYSTEM\n" );
5398          fprintf( fp, "MudName          %s~\n", sys.mud_name );
5399          fprintf( fp, "Highplayers    %d\n", sys.alltimemax );
5400          fprintf( fp, "Highplayertime %s~\n", sys.time_of_max );
5401          fprintf( fp, "Nameresolving  %d\n", sys.NO_NAME_RESOLVING );
5402          fprintf( fp, "Waitforauth    %d\n", sys.WAIT_FOR_AUTH );
5403          fprintf( fp, "Readallmail    %d\n", sys.read_all_mail );


frame 8 is the call the the above function.

 save_sysdata ( sysdata );


print filename: this has a lot of junk in there that im pretty sure should not be there, but i dont know why that this would be corrupt.

$2 = "../system/sysdata.dat\000\000\000´\"IH\000\000\000\000´\"IH\000\000\000\000´\"IH", '\0' <repeats 20 times>, "motd\000\000\000\000\000\000\000\000P÷ð\t../player/v/Vendil\000·\214\202Ä¿@|Ä¿\021\027Ü·\214\202Ä¿ôIè·DÆÜ·\001\000\000\000DÆÜ·\224êÛ·\000\000\000\000ôOé·ôIè·¼\202Ä¿p|Ä¿\021\027Ü·¼\202Ä¿ôIè·\001\000\000\000\001\000\000\000DÆÜ·\224êÛ·\000\000\000\000qaÚ·\000\000\000\000ôOé·\000\000\000\000>Oè·\230\202"...


Anyone got some thoughts. Thanks in advance.
Amended on Fri 06 Jun 2008 08:58 PM by Nick Gammon
Australia Forum Administrator #1
You can see from the backtrace that, in your function, it crashes at db.c:5389

This is the line:


fclose( fpReserve );


I can't see that in SmaugFUSS, however in older versions of Smaug I believe that it opened a "reserved" file descriptor, to keep one for the MUD, and then when it needed to write a file it closed it (to free it up), wrote the file, and then opened it again. I would check where fpReserve gets created. It probably failed and is NULL. This check might help:


if (fpReserve)
  fclose( fpReserve );

Australia Forum Administrator #2
As for the filename, the first part is:


$2 = "../system/sysdata.dat\000


After the \000, who cares? That is the string delimiter.
Australia #3
Thanks Nick, that was it, i took out that line and made the function the same as whats in modern fuss. The version i started with was fuss1.4 so there is likely to be a lot of things in there that have been changed in the latter version.