Assertion `is_present(soldier)' failed

Bug #1829623 reported by GunChleoc
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
widelands
Won't Fix
High
Unassigned

Bug Description

Assert fail with AI game on Ice Wars, tested with https://code.launchpad.net/~widelands-dev/widelands/bug-1829471-worker-preciousness

I can't reproduce on trunk because I get some other, earlier assert failures from the AI.

Autosave: save took 1627 ms
 7: attacking site at 250x242, score 4, with 3 soldiers, attacking 2 times, after 42 seconds
 8: attacking site at 251x237, score 4, with 1 soldiers, attacking 1 times, after 7611 seconds
Forcing flag at (250, 242)
Cmd_EnemyFlagAction::execute player(8): flag->owner(7) number=1
widelands: ../src/logic/map_objects/tribes/militarysite.cc:887: void Widelands::MilitarySite::send_attacker(Widelands::Soldier&, Widelands::Building&): Assertion `is_present(soldier)' failed.

Thread 1 "widelands" received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
51 ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) backtrace
#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#1 0x00007ffff434c801 in __GI_abort () at abort.c:79
#2 0x00007ffff433c39a in __assert_fail_base (fmt=0x7ffff44c37d8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x555557819f40 "is_present(soldier)",
    file=file@entry=0x555557818d00 "../src/logic/map_objects/tribes/militarysite.cc", line=line@entry=887,
    function=function@entry=0x55555781bec0 <Widelands::MilitarySite::send_attacker(Widelands::Soldier&, Widelands::Building&)::__PRETTY_FUNCTION__> "void Widelands::MilitarySite::send_attacker(Widelands::Soldier&, Widelands::Building&)") at assert.c:92
#3 0x00007ffff433c412 in __GI___assert_fail (assertion=0x555557819f40 "is_present(soldier)", file=0x555557818d00 "../src/logic/map_objects/tribes/militarysite.cc", line=887,
    function=0x55555781bec0 <Widelands::MilitarySite::send_attacker(Widelands::Soldier&, Widelands::Building&)::__PRETTY_FUNCTION__> "void Widelands::MilitarySite::send_attacker(Widelands::Soldier&, Widelands::Building&)") at assert.c:101
#4 0x0000555556d5f0cb in Widelands::MilitarySite::send_attacker (this=0x6140011b1440, soldier=..., target=...) at ../src/logic/map_objects/tribes/militarysite.cc:887
#5 0x00005555566cf57d in Widelands::Player::enemyflagaction (this=0x619000af8c80, flag=..., attacker=8 '\b', soldiers=std::vector of length 1, capacity 1 = {...})
    at ../src/logic/player.cc:966
#6 0x0000555557097d01 in Widelands::CmdEnemyFlagAction::execute (this=0x604005f86d90, game=...) at ../src/logic/playercommand.cc:1614
#7 0x0000555557086759 in Widelands::CmdQueue::run_queue (this=0x7fffffff5968, interval=1953, game_time_var=@0x7fffffff50e8: 7622701) at ../src/logic/cmd_queue.cc:122
#8 0x00005555566a45a7 in Widelands::Game::think (this=0x7fffffff50e0) at ../src/logic/game.cc:598
#9 0x0000555556a78857 in InteractiveBase::think (this=0x62000006d080) at ../src/wui/interactive_base.cc:518
#10 0x0000555556903cde in UI::Panel::do_think (this=0x62000006d080) at ../src/ui_basic/panel.cc:483
#11 0x0000555556901043 in UI::Panel::do_run (this=0x62000006d080) at ../src/ui_basic/panel.cc:184
#12 0x000055555639c5ae in UI::Panel::run<UI::Panel::Returncodes> (this=0x62000006d080) at ../src/ui_basic/panel.h:104
#13 0x00005555566a3dcc in Widelands::Game::run (this=0x7fffffff50e0, loader_ui=0x614001182640, start_game_type=Widelands::Game::Loaded, script_to_run="", replay=false,
    prefix_for_replays="nethost") at ../src/logic/game.cc:568
#14 0x00005555567ce31b in GameHost::run (this=0x7fffffff7440) at ../src/network/gamehost.cc:697
#15 0x0000555556386e4f in WLApplication::mainmenu_multiplayer (this=0x611000000180) at ../src/wlapplication.cc:1279
#16 0x00005555563855fa in WLApplication::mainmenu (this=0x611000000180) at ../src/wlapplication.cc:1117
#17 0x000055555637c5cc in WLApplication::run (this=0x611000000180) at ../src/wlapplication.cc:470
#18 0x000055555637831f in main (argc=1, argv=0x7fffffffde78) at ../src/main.cc:44

Tags: ai military

Related branches

Revision history for this message
GunChleoc (gunchleoc) wrote :
Revision history for this message
hessenfarmer (stephan-lutz) wrote :

had the same crash today in a 4 AI player test on Fullmoon. Reloading the last savegame did not trigger the bug again. Seems to be non deterministic, so it might be a pain to track this down.

Changed in widelands:
status: New → Confirmed
Revision history for this message
hessenfarmer (stephan-lutz) wrote :

I assume that the choose soldiers to attack changes were the culprit (r9103)

Revision history for this message
Benedikt Straub (nordfriese) wrote :

I cannot reproduce this bug, but I assume that one of the soldiers chosen for the attack was kicked out (e.g. by hero/rookie exchange) exactly in the brief delay between issuing and executing an enemyflagaction playercommand. That should be an easy fix, just skip soldiers that are no longer present when executing the attack…

Changed in widelands:
assignee: nobody → Benedikt Straub (nordfriese)
status: Confirmed → In Progress
GunChleoc (gunchleoc)
Changed in widelands:
status: In Progress → Fix Committed
assignee: Benedikt Straub (nordfriese) → nobody
Revision history for this message
GunChleoc (gunchleoc) wrote :
Changed in widelands:
status: Fix Committed → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.