Complete.Org: Mailing Lists: Archives: freeciv-dev: July 2001:
[Freeciv-Dev] Re: core file on civserver, http://civserver.freeciv.org/g
Home

[Freeciv-Dev] Re: core file on civserver, http://civserver.freeciv.org/g

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: core file on civserver, http://civserver.freeciv.org/games/18228
From: Thue <thue@xxxxxxx>
Date: Sun, 8 Jul 2001 17:25:33 +0200

Reviewing the relevant code I found a number of places where it did not 
take into account that units could die.

Firstly, the unit loop in update_unit_activities must take into account 
that if the next unit it points to dies the internal unit_list_iterate 
structures will be pointing at freed, invalid memory. The easiest fix 
for this was to just not use unit_list_iterate. (see patch)
I think this was the bug that was triggered.

Secondly, there were some stuff like
   do_unit_goto(punit2);
   send_unit_info(punit2);
Which is not very smart, since it is very much possible for a unit to 
die while moving...

-Thue

On Sunday 08 July 2001 16:03, freeciv@xxxxxxxxxxxxxxxxxxxxx wrote:
> # using $FREECIV_PATH /home/freeciv/freeciv-1.11.6/data
> # running: (echo bt; echo quit; exec yes '') | gdb -d
> /home/freeciv/freeciv-1.11.6/intl -d
> /home/freeciv/freeciv-1.11.6/common -d
> /home/freeciv/freeciv-1.11.6/ai -d
> /home/freeciv/freeciv-1.11.6/server -d
> /home/freeciv/freeciv-1.11.6/client -d
> /home/freeciv/freeciv-1.11.6/client/gui-gtk -d
> /home/freeciv/freeciv-1.11.6/client/gui-xaw -d
> /home/freeciv/freeciv-1.11.6/client/gui-stub
> /home/freeciv/freeciv-1.11.6/server/civserver core GNU gdb 5.0
> Copyright 2000 Free Software Foundation, Inc.
> GDB is free software, covered by the GNU General Public License, and
> you are welcome to change it and/or distribute copies of it under
> certain conditions. Type "show copying" to see the conditions.
> There is absolutely no warranty for GDB.  Type "show warranty" for
> details. This GDB was configured as "i386-redhat-linux"...
> Core was generated by `/home/freeciv/freeciv-1.11.6/server/civserver
> --gamelog gamelog -p 5565 -m -r /'. Program terminated with signal
> 11, Segmentation fault.
> Reading symbols from /lib/libm.so.6...done.
> Loaded symbols for /lib/libm.so.6
> Reading symbols from /usr/lib/libz.so.1...done.
> Loaded symbols for /usr/lib/libz.so.1
> Reading symbols from /lib/libc.so.6...done.
> Loaded symbols for /lib/libc.so.6
> Reading symbols from /lib/ld-linux.so.2...done.
> Loaded symbols for /lib/ld-linux.so.2
> Reading symbols from /lib/libnss_files.so.2...done.
> Loaded symbols for /lib/libnss_files.so.2
> Reading symbols from /lib/libnss_nisplus.so.2...done.
> Loaded symbols for /lib/libnss_nisplus.so.2
> Reading symbols from /lib/libnsl.so.1...done.
> Loaded symbols for /lib/libnsl.so.1
> Reading symbols from /lib/libnss_nis.so.2...done.
> Loaded symbols for /lib/libnss_nis.so.2
> Reading symbols from /lib/libnss_dns.so.2...done.
> Loaded symbols for /lib/libnss_dns.so.2
> Reading symbols from /lib/libresolv.so.2...done.
> Loaded symbols for /lib/libresolv.so.2
> #0  0x8057120 in update_unit_activity (pplayer=0x8123294, punit=0x10,
>     iter=0xbffff918) at unittools.c:934
> 934     int id = punit->id;
> (gdb) #0  0x8057120 in update_unit_activity (pplayer=0x8123294,
> punit=0x10, iter=0xbffff918) at unittools.c:934
> #1  0x8056b44 in update_unit_activities (pplayer=0x8123294) at
> unittools.c:752 #2  0x807202d in update_player_activities
> (pplayer=0x8123294) at plrhand.c:175 #3  0x804c7d8 in end_turn () at
> srv_main.c:417
> #4  0x804e90b in main_loop () at srv_main.c:1716
> #5  0x804ef28 in srv_main () at srv_main.c:1958
> #6  0x8049b75 in main (argc=8, argv=0xbffffa54) at civserver.c:147
> #7  0x40066f31 in __libc_start_main (main=0x804965c <main>, argc=8,
>     ubp_av=0xbffffa54, init=0x8049060 <_init>, fini=0x80afdbc
> <_fini>, rtld_fini=0x4000e274 <_dl_fini>, stack_end=0xbffffa4c)
>     at ../sysdeps/generic/libc-start.c:129
> (gdb)

Attachment: diff
Description: Text Data


[Prev in Thread] Current Thread [Next in Thread]