[Freeciv-Dev] [bug #18221] Crash while playing custom Ruleset

2011-06-14 Thread Marko Lindqvist

Follow-up Comment #4, bug #18221 (project freeciv):

I really should have read code more carefully before sending previous
comment. Actually you do get upkeep back when building or unit is being sold
(at least function headers claim so).

But it now seems to me that there's bug in that not enough buildings/units is
being sold. Just max one of each is being sold. So you can be paying upkeep
for 100 units taking your balance very much negative, and then you get back
upkeep for just one.

Check for continuing selling is not about if there still is units/buildings
remaining to be sold. Instead number of available buildings/units are compared
to variables. And these variables are set to number of remaining
buildings/units when first one is sold -> they will certainly be same as
number of available buildings/units when considering selling second one ->
second one is never sold.

___

Reply to this item at:

  

___
  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

2011-06-14 Thread David Fernandez

Follow-up Comment #3, bug #18221 (project freeciv):

Wow, you tested it pretty fast! Thank you very much.

If the cause is negative treasury, then I know how to workarround it. The bug
must be related to this patch: https://gna.org/bugs/?16413, where I already
noticed treasure reached negative values when I used experimental ruleset and
gold upkeep style 2, altough I did not submit a proper savegame.

Just changing gold upkeep style to 1 in my ruleset, this savegame can
continue without crashes.

If syntron is arround he surely can help to fix it.

___

Reply to this item at:

  

___
  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

2011-06-14 Thread Marko Lindqvist

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:

  

___
  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

2011-06-14 Thread Marko Lindqvist

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=) at
../nptl/sysdeps/unix/sysv/linux/raise.c:64
pid = 
selftid = 
#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 }}
#2  0x77196581 in __assert_fail (assertion=0x578408 "0", file=, 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 = 
unit_count = 
sell_unit = 
#4  update_city_activities (pplayer=0x8f5c70) at server/cityturn.c:517
i = 
r = 
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=,
argv=0x7fffe278)
at server/civserver.c:359
inx = 3
showhelp = 
showvers = 
option = 


___

Reply to this item at:

  

___
  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

2011-06-14 Thread David Fernandez

URL:
  

 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



___

Reply to this item at:

  

___
  Mensaje enviado vía/por Gna!
  http://gna.org/


___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev