segfault on dismantle window in empire Mission4

Bug #1731052 reported by kaputtnik
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
widelands
Fix Released
Undecided
Unassigned

Bug Description

When playing trunk (r8440) with the datadir of the Mission4 branch, i get segfaults while resolving the first objective 'dismantle unproductive buildings'. I started this campaign often and the segfault happens often. I have the feeling that this happens when clicking 'OK' in the confirmation window to dismantle a building and at the same time a new message arrives. At least the crash happens when clicking the mentioned OK button, not sure if a message at the same time arrives.

The backtrace below is just a segfault, attached is another segfault with an assert of representative_image().

Thread 1 "widelands" received signal SIGSEGV, Segmentation fault.
0x000055555fc6c9e8 in ?? ()
(gdb) bt
#0 0x000055555fc6c9e8 in ?? ()
#1 0x000055555629e615 in BuildingWindow::draw (this=0x55555fb89800, dst=...) at ../src/wui/buildingwindow.cc:134
#2 0x000055555619d026 in UI::Panel::do_draw_inner (this=0x55555fb89800, dst=...) at ../src/ui_basic/panel.cc:725
#3 0x000055555619d1f4 in UI::Panel::do_draw (this=0x55555fb89800, dst=...) at ../src/ui_basic/panel.cc:758
#4 0x000055555619d04c in UI::Panel::do_draw_inner (this=0x55555a5295d0, dst=...) at ../src/ui_basic/panel.cc:729
#5 0x000055555619d1f4 in UI::Panel::do_draw (this=0x55555a5295d0, dst=...) at ../src/ui_basic/panel.cc:758
#6 0x000055555619bcb6 in UI::Panel::do_run (this=0x55555fbad610) at ../src/ui_basic/panel.cc:190
#7 0x0000555555e8dac2 in UI::Panel::run<UI::Panel::Returncodes> (this=0x55555fbad610) at ../src/ui_basic/panel.h:99
#8 0x0000555556440de0 in LuaGame::LuaPlayer::message_box (this=0x55555fba4470, L=0x55555ee1f368) at ../src/scripting/lua_game.cc:466
#9 0x0000555556447751 in method_dispatch<LuaGame::LuaPlayer, LuaGame::LuaPlayer> (L=0x55555ee1f368) at ../src/scripting/luna_impl.h:175
#10 0x000055555651de13 in luaD_precall (L=0x55555ee1f368, func=0x55555f349cb0, nresults=0) at ../src/third_party/eris/ldo.c:360
#11 0x000055555653b3de in luaV_execute (L=0x55555ee1f368) at ../src/third_party/eris/lvm.c:1116
#12 0x000055555651e62d in unroll (L=0x55555ee1f368, ud=0x0) at ../src/third_party/eris/ldo.c:550
#13 0x000055555651e989 in resume (L=0x55555ee1f368, ud=0x7fffffff9dec) at ../src/third_party/eris/ldo.c:643
#14 0x000055555651d3e3 in luaD_rawrunprotected (L=0x55555ee1f368, f=0x55555651e7da <resume>, ud=0x7fffffff9dec) at ../src/third_party/eris/ldo.c:142
#15 0x000055555651ea08 in lua_resume (L=0x55555ee1f368, from=0x0, nargs=0) at ../src/third_party/eris/ldo.c:657
#16 0x000055555634e7ea in LuaCoroutine::resume (this=0x55555ee85fa0) at ../src/scripting/lua_coroutine.cc:80
#17 0x00005555560f6cb2 in Widelands::CmdLuaCoroutine::execute (this=0x55555fc5d240, game=...) at ../src/logic/cmd_luacoroutine.cc:44
#18 0x00005555560f86f5 in Widelands::CmdQueue::run_queue (this=0x7fffffffac58, interval=72, game_time_var=@0x7fffffffa838: 49600) at ../src/logic/cmd_queue.cc:123
#19 0x0000555555fc44fe in Widelands::Game::think (this=0x7fffffffa830) at ../src/logic/game.cc:546
#20 0x0000555556235165 in InteractiveBase::think (this=0x55555a5295d0) at ../src/wui/interactive_base.cc:388
#21 0x000055555625216b in InteractivePlayer::think (this=0x55555a5295d0) at ../src/wui/interactive_player.cc:270
#22 0x000055555619c663 in UI::Panel::do_think (this=0x55555a5295d0) at ../src/ui_basic/panel.cc:456
#23 0x000055555619bc4f in UI::Panel::do_run (this=0x55555a5295d0) at ../src/ui_basic/panel.cc:181
#24 0x0000555555e8dac2 in UI::Panel::run<UI::Panel::Returncodes> (this=0x55555a5295d0) at ../src/ui_basic/panel.h:99
#25 0x0000555555fc414e in Widelands::Game::run (this=0x7fffffffa830, loader_ui=0x7fffffffa620, start_game_type=Widelands::Game::NewSPScenario, script_to_run="",
    replay=false, prefix_for_replays="single_player") at ../src/logic/game.cc:516
#26 0x0000555555fc2035 in Widelands::Game::run_splayer_scenario_direct (this=0x7fffffffa830, mapname="campaigns/emp04.wmf", script_to_run="") at ../src/logic/game.cc:231
#27 0x0000555555e860b1 in WLApplication::campaign_game (this=0x555556cfe550) at ../src/wlapplication.cc:1329
#28 0x0000555555e84b6e in WLApplication::mainmenu_singleplayer (this=0x555556cfe550) at ../src/wlapplication.cc:1120
#29 0x0000555555e84482 in WLApplication::mainmenu (this=0x555556cfe550) at ../src/wlapplication.cc:1017
#30 0x0000555555e80c4b in WLApplication::run (this=0x555556cfe550) at ../src/wlapplication.cc:438
#31 0x0000555555e7f007 in main (argc=2, argv=0x7fffffffe568) at ../src/main.cc:49

Tags: crash ui
Revision history for this message
kaputtnik (franku) wrote :
summary: - egfault on dismantle window when a new message arrives
+ segfault on dismantle window when a new message arrives
GunChleoc (gunchleoc)
tags: added: crash ui
Revision history for this message
GunChleoc (gunchleoc) wrote : Re: segfault on dismantle window when a new message arrives

#1 Looks like one of the scenario's custom buildings doesn't have a representative image defined. We should add a check for that.

Revision history for this message
kaputtnik (franku) wrote :

I have to say that the assert with representative_image happens only one time during starting the game for about 15 times.

This morning i couldn't trigger any of the segfaults :-S

Revision history for this message
kaputtnik (franku) wrote :

*lol* as soon i wrote i couldn't trigger the segfault this morning, it happens again...

I think i know how to trigger it: The wells in the east shouldn't produce water. But sometimes they are producing water. Dismantling then causes the crash. I am in hurry for now so my assumption has to be verified.

kaputtnik (franku)
summary: - segfault on dismantle window when a new message arrives
+ segfault on dismantle window in empire Mission4
Revision history for this message
kaputtnik (franku) wrote :

It's not the well.

It happens when the last buildings wants to be dismantled.

Also strange: Sometimes a window pops which should only pop up when clicking on a farm.

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

Ok will have a look on that this evening.
The issue with the unwanted window should have been solved. Anyhow I will try to fix this again.

@ GunChleoc: The issue with the unwanted Pop of the window would be easier if I could directly check for the Name of the building.

The mechanism why it is triggering is that I check if a building window is opened and if it has not a dismantle button and if it has no wares tab. So if you close any building window right after the first condition has been confirmed then the negative tests are automatically true. will need to implement a safecheck to prevent this.

Revision history for this message
GunChleoc (gunchleoc) wrote :

The dynamic_tribe_loading branch has a bug in it that there are nonexistent wares during cleanup. I have found the commit that causes the bug, but I don't understand why it's happening yet.

If you run

    bzr revert -r8438

on that branch and recompile, that might fix the crash.

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

@ Gun Chleoc :
maybe I brought in some confusion with my comment. As far as I understand the original bug (segfault when dismantling) was found in trunk and therefore ther is no dependency to the "dynamic tribe loading" branch. I will test although I have not seen this yet.

The other thing is the unwanted popup of the messages window delivering the farm plans objective. This I have seen before and built in a second check if the right window is still open. However this seems not to work therefore I will have a look and try to prevent this. The solution just would be easier if I could check for a specific Building window as already discussed in the Mission 4 forum thread.

Still we will need to look for the reason why the bug is happening in trunk 8440. May suggest that kaputtnik will try a newer revision and check if it is still there. Another important information would be which OS he is using. I am on win 10 build 1607 and didn't saw the behaviour in my test installation which is r8478

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

ok
the message after dismantling the buildings was triggered without any delay maybe this could have caused some problems. I inserted a sleep(2000) before so now the mesage is discoupled from the last dismantling. Don't know whether this was the problem though cause I couldn't reproduce the segfault. Maybe the diversion between datadir (nearly actual revision) and trunk revision of kapputnik (8440) could have a negative impact too.
Regarding the unwanted window I found another condition to check for which should prevent the problem. I couldn't trigger the message again which I could in the revision before.
new revision is up please kaputtnik check again

Revision history for this message
GunChleoc (gunchleoc) wrote :

I need to know more about #8 - please open a new bug and tell me if you need the building type (e.g. "empire_farm") or the building's serial number.

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

in this case the name would be sufficient, but if it is not to much work other attributes of the building window could be helpful as well I'll create a new bug with all attributes I consider possibly valuable for scenario design

Revision history for this message
kaputtnik (franku) wrote :

Hm, starting the game from the Mission4 branch and starting from trunk with option --datadir shows different results:

Mission4 branch r8436 last updated with trunk on 2017-11-10 :
1. Shows a lot of " 2: Players statistics are still empty" lines in the console. I remember there was a bug regarding this which was solved?
2. The game crashes reproducible while saving after solving the first objective with a segfault:

> Thread 1 "widelands" received signal SIGSEGV, Segmentation fault.
> 0x00007ffff5148506 in __strlen_sse2 () from /usr/lib/libc.so.6

Starting from trunk r8487:
All works fine, also the lines with missing Player statistics aren't shown.

I am on linux.

Revision history for this message
kaputtnik (franku) wrote :
Revision history for this message
hessenfarmer (stephan-lutz) wrote :

As I am on windows I just have the possibilty to use datadir option currently. I could launch a merge request which would trigger an appveyor build though to check it. But I don't know how to interpret the attached textfile. I can't imagine why a branch with merged trunk could behave different then trunk itself. Please tell me what to do.
Did you see the original crashes in the latest revision though. was the fix of adding some sleeptime sufficient. still I don't understand why a this could have caused a crash.

Revision history for this message
kaputtnik (franku) wrote :

Maybe i messed up some things... i will try to compile the Mission4 branch from scratch and test again.

Revision history for this message
GunChleoc (gunchleoc) wrote :

A crash similar to #12 was fixed recently: https://bugs.launchpad.net/widelands/+bug/1724073

Seems like there is more to it.

Revision history for this message
kaputtnik (franku) wrote :

Ok, after downloading a fresh copy and compiling it seems to work now. But i want to make some more tests... maybe after my tournament game this evening.

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

Ok I will do nothing until kaputtnik has checked the issue again.

Good luck in the tournament then.

Revision history for this message
kaputtnik (franku) wrote :

Lost the tournament game :-)

The crash mentioned in this bug is imho gone. But i get very rarely the crash of representative_image (for about 1 time when starting the campaign 15 times):

building_window: table: 0x555562270180
Buttons disamntle: nil
Tab wares: nil

Thread 1 "widelands" received signal SIGSEGV, Segmentation fault.
0x000055555629f56f in BuildingWindow::draw (this=0x5555623efdb0, dst=...) at ../src/wui/buildingwindow.cc:134
134 const Image* image = building().representative_image();

Couldn't reproduce with specific steps. Maybe this is related with bug 1691336 (Building window changes its assigned window)?

GunChleoc should decide if this bug is fixed for now, i would mark it as fixed.

kaputtnik (franku)
Changed in widelands:
status: New → Fix Committed
Changed in widelands:
milestone: none → build20-rc1
Revision history for this message
GunChleoc (gunchleoc) wrote :

Fixed in build20-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.

Other bug subscribers

Remote bug watches

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