Assertion `it != end()' failed in message queue

Bug #1207477 reported by cghislai
18
This bug affects 2 people
Affects Status Importance Assigned to Milestone
widelands
Fix Released
High
cghislai

Bug Description

Trying to play empire 2, game crashed on that assertion:

src/logic/message_queue.h:128: void Widelands::MessageQueue::expire_message(const Widelands::Message_Id&): Assertion `it != end()' failed.

Related branches

Changed in widelands:
assignee: nobody → cghislai (charlyghislain)
importance: Undecided → Critical
importance: Critical → High
milestone: none → build18-rc1
Revision history for this message
cghislai (charlyghislain) wrote :

So this happen when a message is added with a timeout, so a CmdExpire is sent for when the timeout will run off. Then the building associated is destroyed, and a CmdExpire for that message is sent directly. When the CmdExpire for the timout will be executed, the message is not present anymore.

There are different possible fixes.
Either the destroyed signal is connected to a new slot that will remove the pending CmdExpire. That involves new method in the cmdqueue, and I need to ensure that the cmd is not sent over the network or to the replay writer before it is executed.
Either, upon object removal, I parse all command and remove any pending cmdexpire. This also involve new functionnality in the queue and extra care for game synching.
Either any pending cmd expire for the same object is removed in the command execution itself. Synching won't be an issue here.
Either i remove that assert and assume that if message is not present it was already expired. That's the easy fix but it does not sound bad to my hears.

Revision history for this message
SirVer (sirver) wrote :

> Either i remove that assert and assume that if message is not present it was already expired. That's the easy fix but it does not sound bad to my hears.

I'd go with this. Make sure to add a clear comment thoug.

Revision history for this message
cghislai (charlyghislain) wrote :

Fixed in 6692

Changed in widelands:
status: New → Fix Committed
Revision history for this message
MP (pagel-d) wrote :

still getting a crash in empire 2 during an assault on enemy HQ. Did not happen when I repeated from the last autosave, but here's that autosave anyway.

Revision history for this message
MP (pagel-d) wrote :

(bzr6695)

Revision history for this message
Steven De Herdt (stdh) wrote :
Download full text (4.2 KiB)

In rev6692: when an enemy conquered a sentry of mine, i got a "bad news" sound but no corresponding message in my inbox. Could this be related?

Also, possibly related: when running the lua test "widelands --scenario=test/lua/ts.wmf", it SIGSEGVs on sending a "Hallo World!" message (seen in the argument in #2):
0x0868bfdf in boost::shared_ptr<boost::signals::detail::signal_base_impl>::operator-> (this=0x4)
    at /usr/include/boost/smart_ptr/shared_ptr.hpp:424
424 BOOST_ASSERT(px != 0);
(gdb) bt
#0 0x0868bfdf in boost::shared_ptr<boost::signals::detail::signal_base_impl>::operator-> (this=0x4)
    at /usr/include/boost/smart_ptr/shared_ptr.hpp:424
#1 0x087022f0 in boost::signal1<void, unsigned int, boost::last_value<void>, int, std::less<int>, boost::function<void (unsigned int)> >::connect(boost::slot<boost::function<void (unsigned int)> > const&, boost::signals::connect_position) (this=0x4, in_slot=..., at=boost::signals::at_back)
    at /usr/include/boost/signals/signal_template.hpp:286
#2 0x086f9bbb in Widelands::Player::add_message (this=0xa3b5af8, game=..., message=..., popup=false)
    at /home/steven/widelands/code-repo/widelands/src/logic/player.cc:320
#3 0x08692c1b in LuaGame::L_Player::send_message (this=0xa6da530, L=0x8f44af0)
    at /home/steven/widelands/code-repo/widelands/src/scripting/lua_game.cc:390
#4 0x0869a382 in m_method_dispatch<LuaGame::L_Player, LuaGame::L_Player> (L=0x8f44af0)
    at /home/steven/widelands/code-repo/widelands/src/scripting/luna_impl.h:184
#5 0xb7e3b17f in ?? () from /usr/lib/i386-linux-gnu/liblua5.1.so.0
#6 0xb7e45fcd in ?? () from /usr/lib/i386-linux-gnu/liblua5.1.so.0
#7 0xb7e3b5f8 in ?? () from /usr/lib/i386-linux-gnu/liblua5.1.so.0
#8 0xb7e358e0 in ?? () from /usr/lib/i386-linux-gnu/liblua5.1.so.0
#9 0xb7e3a820 in ?? () from /usr/lib/i386-linux-gnu/liblua5.1.so.0
#10 0xb7e3b7cf in ?? () from /usr/lib/i386-linux-gnu/liblua5.1.so.0
#11 0xb7e36eb4 in lua_pcall () from /usr/lib/i386-linux-gnu/liblua5.1.so.0
#12 0xb7e48a64 in ?? () from /usr/lib/i386-linux-gnu/liblua5.1.so.0
#13 0xb7e3b17f in ?? () from /usr/lib/i386-linux-gnu/liblua5.1.so.0
#14 0xb7e45fcd in ?? () from /usr/lib/i386-linux-gnu/liblua5.1.so.0
#15 0xb7e3b5f8 in ?? () from /usr/lib/i386-linux-gnu/liblua5.1.so.0
#16 0xb7e358e0 in ?? () from /usr/lib/i386-linux-gnu/liblua5.1.so.0
#17 0xb7e3a820 in ?? () from /usr/lib/i386-linux-gnu/liblua5.1.so.0
#18 0xb7e3b7cf in ?? () from /usr/lib/i386-linux-gnu/liblua5.1.so.0
#19 0xb7e36eb4 in lua_pcall () from /usr/lib/i386-linux-gnu/liblua5.1.so.0
#20 0x0868066c in LuaInterface_Impl::run_script (this=0x8f44ac0, ns=..., name=...)
    at /home/steven/widelands/code-repo/widelands/src/scripting/scripting.cc:302
#21 0x087602b2 in Widelands::Cmd_LuaScript::execute (this=0xa39b770, game=...)
    at /home/steven/widelands/code-repo/widelands/src/logic/cmd_luascript.cc:32
#22 0x0870be23 in Widelands::Cmd_Queue::run_queue (this=0xbfffe90c, interval=1000, game_time_var=@0xbfffe7b0: 0)
    at /home/steven/widelands/code-repo/widelands/src/logic/cmd_queue.cc:132
#23 0x08710cd9 in Widelands::Game::think (this=0xbfffe780) at /home/steven/widelands/code-repo/widelands/src/logic/game.cc:635
#2...

Read more...

Revision history for this message
cghislai (charlyghislain) wrote :

I'll check that. Thanks for reporting.

#6: "In rev6692: when an enemy conquered a sentry of mine, i got a "bad news" sound but no corresponding message in my inbox. Could this be related?"

It may, but getting a sound for a message that is going to be expired is another issue that needs to be addressed. I'll open a new issue for that.

Changed in widelands:
status: Fix Committed → Confirmed
Revision history for this message
MP (pagel-d) wrote :

it might be that my latest issue (#4 here) is really bug 1208229

I really should build it myself in a debug mode:P

Revision history for this message
cghislai (charlyghislain) wrote :

#6 thanks for pointing this, i fixed that.
#8 Since it was another issue, i will close this bug as soon as the branch fixing the test gets merged

Changed in widelands:
status: Confirmed → In Progress
Changed in widelands:
status: In Progress → New
status: New → Fix Committed
Revision history for this message
SirVer (sirver) wrote :

Released in build-18 rc1.

Changed in widelands:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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