bugFreeciv - Bugs: bug #20700, assert "(index) >= 0...

 
 
Show feedback again

bug #20700: assert "(index) >= 0 && (index) < MAP_INDEX_SIZE" failed

Submitted by:  Marko Lindqvist <cazfi>
Submitted on:  Mon 01 Apr 2013 11:05:14 PM UTC  
 
Category: generalSeverity: 3 - Normal
Priority: 5 - NormalStatus: Fixed
Assigned to: Marko Lindqvist <cazfi>Open/Closed: Closed
Release: r22640Operating System: None
Planned Release: 2.3.5, 2.4.0, 2.5.0

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

Please log in, so followups can be emailed to you.

 

(Jump to the original submission Jump to the original submission)

Fri 05 Apr 2013 09:28:45 PM UTC, SVN revision 22678:

In case of forced selling of units, sell cargo before their transport.
That way seller gets money from all lost units, and most importantly server
does not crash by trying to sell cargo unit that has already drowned when
transport was sold.

See bug #20700

(Browse SVN revision 22678)

Marko Lindqvist <cazfi>
Project AdministratorIn charge of this item.
Fri 05 Apr 2013 09:28:40 PM UTC, SVN revision 22677:

In case of forced selling of units, sell cargo before their transport.
That way seller gets money from all lost units, and most importantly server
does not crash by trying to sell cargo unit that has already drowned when
transport was sold.

See bug #20700

(Browse SVN revision 22677)

Marko Lindqvist <cazfi>
Project AdministratorIn charge of this item.
Fri 05 Apr 2013 09:28:34 PM UTC, SVN revision 22676:

In case of forced selling of units, sell cargo before their transport.
That way seller gets money from all lost units, and most importantly server
does not crash by trying to sell cargo unit that has already drowned when
transport was sold.

See bug #20700

(Browse SVN revision 22676)

Marko Lindqvist <cazfi>
Project AdministratorIn charge of this item.
Wed 03 Apr 2013 06:22:37 PM UTC, comment #4:

After total of about 45 hours of autogame execution I've both confirmed that the issue was the one I noticed, and the already submitted patch seems to work. (Change comes to play first time much earlier where even the old code luckily didn't crash, changing how the autogame proceeds, so fix is not tested against exact old crashing situation)

Marko Lindqvist <cazfi>
Project AdministratorIn charge of this item.
Tue 02 Apr 2013 12:23:27 AM UTC, comment #3:

> If there's both transport and its cargo in the list of potential
> units to sell, selling transport first will cause, due to
> recursive wiping, cargo also to get destroyed, but to remain in
> the list of potential units to sell.


Untested patch for that one.

(file #17652, file #17653)

Marko Lindqvist <cazfi>
Project AdministratorIn charge of this item.
Mon 01 Apr 2013 11:56:02 PM UTC, comment #2:

I don't know if it's the problem I'm seeing, but there's apparent problem with the code when multiple units are being sold.

If there's both transport and its cargo in the list of potential units to sell, selling transport first will cause, due to recursive wiping, cargo also to get destroyed, but to remain in the list of potential units to sell.

Marko Lindqvist <cazfi>
Project AdministratorIn charge of this item.
Mon 01 Apr 2013 11:47:05 PM UTC, comment #1:

Note that text mentioning AEGIS Cruiser in static buffer is from previous unit_tile_link() call (or so I believe). Currently handled unit seems to have corrupted type and tile, later values in structure seem sane. So this seems like memory corruption bug somewhere, and reproducibility might be fleeting.

Marko Lindqvist <cazfi>
Project AdministratorIn charge of this item.
Mon 01 Apr 2013 11:05:14 PM UTC, original submission:

Attached autogame asserts (but only at turn 393 and it has a lot of players for server to handle, so be prepared to long wait if you run the autogame)

bt full
#0 0x00007ffff668defb in raise (sig=<optimized out>)
at ../nptl/sysdeps/unix/sysv/linux/pt-raise.c:42
No locals.
#1 0x0000000000670b52 in fc_assert_fail (file=0x71e181 "common/map.h",
function=0x71eb00 "index_to_map_pos_y", line=718,
assertion=0x71e158 "(index) >= 0 && (index) < MAP_INDEX_SIZE",
message=0x74ef94 "nologmsg:%s") at utility/log.c:520
level = LOG_FATAL
#2 0x000000000057befe in index_to_map_pos_y (index=78302080)
at common/map.h:718
map_x = 32767
map_y = -163131160
_FUNCTION_ = "index_to_map_pos_y"
#3 0x000000000057e695 in unit_tile_link (punit=0x4a38b60)
at common/featured_text.c:1126
buf = "[l tgt=\"tile\" x=88 y=47]AEGIS Cruiser[/l]\000\000\000]", '\000' <repeats 82 times>
tag_name = 0x71e512 "l"
#4 0x0000000000497cab in sell_random_unit (pplayer=0x1755660,
punitlist=0x493b490) at server/cityturn.c:1914
punit = 0x4a38b60
gold_upkeep = 2
r = 2
_FUNCTION_ = "sell_random_unit"
#5 0x000000000049801c in player_balance_treasury_units_and_buildings (
pplayer=0x1755660) at server/cityturn.c:1971
pimprlist = 0x481df30
punitlist = 0x493b490
sell_unit = true
_FUNCTION_ = "player_balance_treasury_units_and_buildings"
#6 0x00000000004939c0 in update_city_activities (pplayer=0x1755660)
at server/cityturn.c:581
cities = 0x7fffffffdec8
i = 0
r = 0
buf = '\000' <repeats 96 times>, "PEe\001\000\000\000\000PEe\001\000\000\000\000PEe\001\000\000\000\000\330\336\377\377\377\177\000\000$", '\000' <repeats 11 times>, "%", '\000' <repeats 11 times>, "p\340\377\377\377\177\000\000\023\307d\000\000\000\000\000(\215\271\000\000\000\000\000\240\340\377\377\377\177\000\000\267\324d\000\000\000\000"
n = 27
gold = 11
_FUNCTION_ = "update_city_activities"
#7 0x000000000043d24a in end_phase () at server/srv_main.c:1029
MY_i = 98
pplayer = 0x1755660
_FUNCTION_ = "end_phase"
#8 0x0000000000440e64 in srv_running () at server/srv_main.c:2337
eot_timer = 0x1646be0
save_counter = 19
i = 0
is_new_turn = true
need_send_pending_events = false
_FUNCTION_ = "srv_running"
#9 0x00000000004420ee in srv_main () at server/srv_main.c:2788
_FUNCTION_ = "srv_main"
#10 0x00000000004366df in main (argc=6, argv=0x7fffffffe368)
at server/civserver.c:454
inx = 6
showhelp = false
showvers = false
option = 0xb968a0 " \261\232"
_FUNCTION_ = "main"

Marko Lindqvist <cazfi>
Project AdministratorIn charge of this item.

 

(Note: upload size limit is set to 1024 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

Attached Files
file #17651:  mapindex.serv added by cazfi (183B - application/octet-stream)

 

Depends on the following items: None found

Digest:
   bug dependencies.

 

Carbon-Copy List
  • -unavailable- added by cazfi (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 10 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sun 07 Apr 2013 10:23:28 AM UTCjtnDependencies-=>bugs #20722 is dependent
    Fri 05 Apr 2013 09:29:08 PM UTCcazfiStatusReady For Test=>Fixed
      Assigned toNone=>cazfi
      Open/ClosedOpen=>Closed
    Tue 02 Apr 2013 12:23:27 AM UTCcazfiAttached File-=>Added SellCargoBeforeTransport.patch, #17652
      Attached File-=>Added SellCargoBeforeTransport-S2_3.patch, #17653
      CategoryNone=>general
      StatusNone=>Ready For Test
      Planned Release=>2.3.5, 2.4.0, 2.5.0
    Mon 01 Apr 2013 11:05:14 PM UTCcazfiAttached File-=>Added mapindex.serv, #17651
    Show feedback again

    Back to the top


    Powered by Savane 3.1-cleanup