[Freeciv-Dev] [bug #18221] Crash while playing custom Ruleset
URL: http://gna.org/bugs/?18221 Summary: Crash while playing custom Ruleset Project: Freeciv Submitted by: tirolalira Submitted on: mar 14 jun 2011 21:51:25 GMT Category: None Severity: 3 - Normal Priority: 5 - Normal Status: None Assigned to: None Originator Email: Open/Closed: Open Release: Discussion Lock: Any Operating System: Microsoft Windows Planned Release: ___ Details: Freeciv v2.2.5 crashes while playing my custom Ruleset, and I have been unable to find the cause. The server crashes during AI turn showing the Windows error message this program had an error and it will be closed... It uses to crash arround turn 200, so it is surely related to timeframe (new techs, units, etc). Most of the times I can continue playing if I reload the previous autosave, but then it keeps crashing randomly. I have been able to save a game that crashes everytime I press end turn. I attach a .zip file including: 1- Custom Ruleset civ2-3, to install over v2.2.5 2- Savegame: press end turn to recreate the crash 3- The log file generated the first time it crashed (I was playing with spain in AI mode). I played similar ruleset over v2.2.3 without problems, and I keep track of my changes while adapting it for 2.2.5. I would thank any help to find the bug and fix it. ___ File Attachments: --- Date: mar 14 jun 2011 21:51:25 GMT Name: Crash_civ2-3.zip Size: 652kB By: tirolalira http://gna.org/bugs/download.php?file_id=13201 ___ Reply to this item at: http://gna.org/bugs/?18221 ___ Mensaje enviado vía/por Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] [bug #18221] Crash while playing custom Ruleset
Update of bug #18221 (project freeciv): Category:None = general Status:None = Confirmed Assigned to:None = cazfi ___ Follow-up Comment #1: Nicely reproducible in S2_2 head. This is assert failure caused by the fact that player somehow gets negative balance. Backtrace follows. freeciv-server: server/cityturn.c:1834: player_balance_treasury_units_and_buildings: Assertion `0' failed. (gdb) bt full #0 0x7719d3d5 in raise (sig=value optimized out) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64 pid = value optimized out selftid = value optimized out #1 0x771a0650 in abort () at abort.c:92 act = {__sigaction_handler = {sa_handler = 0x578408, sa_sigaction = 0x578408}, sa_mask = {__val = { 140737340187112, 140737488346496, 1834, 140737488346736, 140737339251622, 206158430232, 140737488346752, 140737488346528, 140737339163480, 206158430256, 140737488346776, 13255024, 7392, 8390880602273947706, 2316873722724511593, 140737488348520}}, sa_flags = -148176321, sa_restorer = 0x55ad80} sigs = {__val = {32, 0 repeats 15 times}} #2 0x77196581 in __assert_fail (assertion=0x578408 0, file=value optimized out, line=1834, function=0x55c220 player_balance_treasury_units_and_buildings) at assert.c:81 buf = 0xca4170 freeciv-server: server/cityturn.c:1834: player_balance_treasury_units_and_buildings: Assertion `0' failed.n #3 0x0044985c in player_balance_treasury_units_and_buildings (pplayer=0x8f5c70) at server/cityturn.c:1834 ci = {pcity = 0x23ddc70, pimprove = 0x865900} impr_count = value optimized out unit_count = value optimized out sell_unit = value optimized out #4 update_city_activities (pplayer=0x8f5c70) at server/cityturn.c:517 i = value optimized out r = value optimized out n = 0 gold = 2 __PRETTY_FUNCTION__ = update_city_activities #5 0x0040a29d in end_phase () at server/srv_main.c:891 MY_i = 14 pplayer = 0x8f5c70 #6 srv_running () at server/srv_main.c:2081 save_counter = 1 is_new_turn = true eot_timer = 0xb464b0 need_send_pending_events = false #7 srv_main () at server/srv_main.c:2446 No locals. #8 0x0040406f in main (argc=value optimized out, argv=0x7fffe278) at server/civserver.c:359 inx = 3 showhelp = value optimized out showvers = value optimized out option = value optimized out ___ Reply to this item at: http://gna.org/bugs/?18221 ___ Message sent via/by Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] [bug #18221] Crash while playing custom Ruleset
Follow-up Comment #2, bug #18221 (project freeciv): Well, I think that there's nothing in the code that would assert that balance really gets positive before this failing assert(). But this is not simply matter of removing the assert() as negative balance breaks a lot of things then on. Code block before the assert() is like: while(balance 0 something_to_sell) { sell_something() } but nothing prevents balance from still being negative when everything is sold. One thing we may want to change in development code (probably not in stable branches) is that upkeep for units and buildings being sold because of negative balance would not be paid. Currently their upkeep is already paid by the time we sell them. In stable branches, and temporarily in trunk, I'd just make simple hack to set balance = 0 if it's still negative after we have sold everything. I also think that this bug can manifest itself only if upkeep of some unit or building is higher than its selling value - otherwise selling it would always restore balance to at least same level than it was before paying upkeep. Original reporter may want to use that information to make to his ruleset such temporary changes that it won't crash freeciv until this is fixed. However, it's possible that there is some bug in how selling value (or upkeep) is calculated causing former to be smaller than latter even if ruleset seems not to allow that. I'll trace exact cause of this reproducible crash a bit further. ___ Reply to this item at: http://gna.org/bugs/?18221 ___ Message sent via/by Gna! http://gna.org/ ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev