FreeOrion

Forums for the FreeOrion project
It is currently Tue May 21, 2013 8:25 pm

All times are UTC




Post new topic Reply to topic  [ 52 posts ]  Go to page 1, 2, 3, 4  Next
Author Message
 Post subject: Segfault in FleetWnd::PlotMovement()
PostPosted: Thu Mar 01, 2007 5:08 pm 
Offline
Space Floater

Joined: Sat Oct 16, 2004 10:33 am
Posts: 16
Location: Bavaria/Germany
I just compiled freeorion and all of its dependancys but im unable to get past round 2 fo always crashes in FleetWnd::PlotMovement()

gcc 4.1.1
boost 1.33.1
sdl 1.2.11
gigi from svn

backtrace from gdb is:
#0 0x0828cd30 in FleetWnd::PlotMovement ()
#1 0x0828d0ac in FleetWnd::SystemBrowsed ()
#2 0x0823c1b3 in boost::function1<void, int, std::allocator<void> >::operator() ()
#3 0x0823c36a in boost::operator++<boost::signals::detail::slot_call_iterator<boost::signals::detail::call_bound1<void>::caller<int, boost::function<void ()(int), std::allocator<void> > >, boost::signals::detail::named_slot_map_iterator>, boost::signals::detail::unusable, boost::single_pass_traversal_tag, boost::signals::detail::unusable const&, int> ()
#4 0x0823c7b8 in boost::signal1<void, int, boost::last_value<void>, int, std::less<int>, boost::function<void ()(int), std::allocator<void> > >::operator() ()
#5 0x083188b0 in MapWnd::MouseEnteringSystem ()
#6 0x0823c1b3 in boost::function1<void, int, std::allocator<void> >::operator() ()
#7 0x0823c36a in boost::operator++<boost::signals::detail::slot_call_iterator<boost::signals::detail::call_bound1<void>::caller<int, boost::function<void ()(int), std::allocator<void> > >, boost::signals::detail::named_slot_map_iterator>, boost::signals::detail::unusable, boost::single_pass_traversal_tag, boost::signals::detail::unusable const&, int> ()
#8 0x0823c7b8 in boost::signal1<void, int, boost::last_value<void>, int, std::less<int>, boost::function<void ()(int), std::allocator<void> > >::operator() ()
#9 0x0838028c in SystemIcon::MouseEnter ()
#10 0xb7d0b203 in GG::Wnd::HandleEvent () from /opt/freeorion/lib/libGiGi.so
#11 0xb7c98554 in GG::GUI::CheckedGetWindowUnder () from /opt/freeorion/lib/libGiGi.so
#12 0xb7c9aa21 in GG::GUI::HandleGGEvent () from /opt/freeorion/lib/libGiGi.so
#13 0xb7f79ec5 in SDLGUI::HandleSystemEvents () from /opt/freeorion/lib/libGiGiSDL.so
#14 0xb7c80ea8 in GG::EventPump::operator() () from /opt/freeorion/lib/libGiGi.so
#15 0xb7f7a2e4 in SDLGUI::Run () from /opt/freeorion/lib/libGiGiSDL.so
#16 0xb7c96a51 in GG::GUI::operator() () from /opt/freeorion/lib/libGiGi.so
#17 0xb7f7a0ad in SDLGUI::operator() () from /opt/freeorion/lib/libGiGiSDL.so
#18 0x082150c0 in main ()


Hope this information helps


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 01, 2007 5:39 pm 
Offline
Programming, Design, and De Facto Lead
User avatar

Joined: Wed Oct 08, 2003 1:33 am
Posts: 7890
Location: Vancouver, BC
Could you post a bug report on sourceforge, with slightly more detail about what you do to cause the bug? In particular, do you just mouse over the system and it crashes, or do you have to click or do something else first? Does this happen on turn 1, or just turn 2?

http://sourceforge.net/tracker/?atid=54 ... p_id=75752

Also, if you feel like debugging, you could throw some

Logger().errorStream() << "debug text: " << variable << " etc...";

lines into the offending function, and observe the resulting console output, in order to narrow down what line the problem occurs on. It's hard to tell what might be causing this just from the function name.

That said, this might be related to the same bug that's causing seg faults on Linux ("[ 1625064 ] the game seg faults" on the bug tracker) due to a bug with Boost Signals.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 01, 2007 5:50 pm 
Offline
Space Floater

Joined: Sat Oct 16, 2004 10:33 am
Posts: 16
Location: Bavaria/Germany
hello
I've run it some times again

bug occurs only if a fleet is moving meaning if i don't move any fleet the game won't crash within some turns (didn't test more than 5 turns)
don't know what to call the bug for sf-buglist "fleet move segfault" seems to be a little bit to generic to me ;-)

moving any fleet leads to a crash but not exactly everytime in FleetWnd::PlotMovement () I've attached two other bts but I'm not quite sure if the second one adresses the same bug (it occured while moving the mouse to the "turn"-button after giving the fleet the orders i don't even know if it occured before or after clicking the button)

edit: It seems to occur on mouse over a system possibly really the boost bug ... does fo work with later versions of boost?


##backtrace 1
#0 0xb779fdae in __dynamic_cast () from /usr/lib/libstdc++.so.6
#1 0x0828c2f2 in FleetWnd::FleetInRow ()
#2 0x0828cd78 in FleetWnd::PlotMovement ()
#3 0x0828d0ac in FleetWnd::SystemBrowsed ()
#4 0x0823c1b3 in boost::function1<void, int, std::allocator<void> >::operator() ()
#5 0x0823c36a in boost::operator++<boost::signals::detail::slot_call_iterator<boost::signals::detail::call_bound1<void>::caller<int, boost::function<void ()(int), std::allocator<void> > >, boost::signals::detail::named_slot_map_iterator>, boost::signals::detail::unusable, boost::single_pass_traversal_tag, boost::signals::detail::unusable const&, int> ()
#6 0x0823c7b8 in boost::signal1<void, int, boost::last_value<void>, int, std::less<int>, boost::function<void ()(int), std::allocator<void> > >::operator() ()
#7 0x083188b0 in MapWnd::MouseEnteringSystem ()
#8 0x0823c1b3 in boost::function1<void, int, std::allocator<void> >::operator() ()
#9 0x0823c36a in boost::operator++<boost::signals::detail::slot_call_iterator<boost::signals::detail::call_bound1<void>::caller<int, boost::function<void ()(int), std::allocator<void> > >, boost::signals::detail::named_slot_map_iterator>, boost::signals::detail::unusable, boost::single_pass_traversal_tag, boost::signals::detail::unusable const&, int> ()
#10 0x0823c7b8 in boost::signal1<void, int, boost::last_value<void>, int, std::less<int>, boost::function<void ()(int), std::allocator<void> > >::operator() ()
#11 0x0838028c in SystemIcon::MouseEnter ()
#12 0xb7cb1203 in GG::Wnd::HandleEvent () from /opt/freeorion/lib/libGiGi.so
#13 0xb7c3e554 in GG::GUI::CheckedGetWindowUnder () from /opt/freeorion/lib/libGiGi.so
#14 0xb7c40a21 in GG::GUI::HandleGGEvent () from /opt/freeorion/lib/libGiGi.so
#15 0xb7f1fec5 in SDLGUI::HandleSystemEvents () from /opt/freeorion/lib/libGiGiSDL.so
#16 0xb7c26ea8 in GG::EventPump::operator() () from /opt/freeorion/lib/libGiGi.so
#17 0xb7f202e4 in SDLGUI::Run () from /opt/freeorion/lib/libGiGiSDL.so
#18 0xb7c3ca51 in GG::GUI::operator() () from /opt/freeorion/lib/libGiGi.so
#19 0xb7f200ad in SDLGUI::operator() () from /opt/freeorion/lib/libGiGiSDL.so
#20 0x082150c0 in main ()


########backtrace 2
1172771147 DEBUG : telling fleet to explore3
1172771147 DEBUG : telling fleet to explore3
1172771147 DEBUG : telling fleet to explore3
1172771147 DEBUG : telling fleet to explore3
1172771147 DEBUG : telling fleet to explore3
1172771147 DEBUG : Generated AI Orders, starting turn update
1172771147 DEBUG : Done dealing with turn update message
1172771154 ERROR : main() caught exception(std::exception): vector::_M_range_check
[Thread -1243108464 (LWP 15178) exited]
[Thread -1234715760 (LWP 15177) exited]
1172771154 FATAL : Initiating Exit (code 1 - error termination)
1172771154 DEBUG : SDLQuit() complete.
1172771154 FATAL : Initiating Exit (code 1 - error termination)
[Thread -1272685680 (LWP 15180) exited]
1172771154 DEBUG : SDLQuit() complete.
1172771154 FATAL : Initiating Exit (code 1 - error termination)
1172771154 DEBUG : SDLQuit() complete.
[Thread -1251591280 (LWP 15179) exited]
1172771154 FATAL : Initiating Exit (code 1 - error termination)
1172771154 DEBUG : SDLQuit() complete.

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1230108944 (LWP 15176)]
0xb7f2a5e7 in NET2_TCPClose () from /opt/freeorion/lib/libGiGiNet.so
(gdb) bt
#0 0xb7f2a5e7 in NET2_TCPClose () from /opt/freeorion/lib/libGiGiNet.so
#1 0x08217b98 in ClientNetworkCore::~ClientNetworkCore ()
#2 0x08203a10 in ClientApp::~ClientApp ()
#3 0x08212feb in HumanClientAppSoundFMOD::~HumanClientAppSoundFMOD ()
#4 0x082150ce in main ()


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 01, 2007 6:22 pm 
Offline
Programming, Design, and De Facto Lead
User avatar

Joined: Wed Oct 08, 2003 1:33 am
Posts: 7890
Location: Vancouver, BC
sapier wrote:
does fo work with later versions of boost?

1.33.1 seems to be the lastest version, so... no, not really...

For now, you might try editing FleetWnd::SystemBrowsed so that PlotMovement isn't called. I'm not sure if this will have side effects, and you might still get the crash if right-clicking to give move orders, but it's perhaps worth a try?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 01, 2007 8:07 pm 
Offline
Space Floater

Joined: Sat Oct 16, 2004 10:33 am
Posts: 16
Location: Bavaria/Germany
commenting out PlotMovement fixes the crash problem... a short look at PlotMovement didn't show any boost functions to be called from it but some "for" an i++ vector operations probably there is really hidden a bug I'll have a closer look to it


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 01, 2007 8:29 pm 
Offline
Space Floater

Joined: Sat Oct 16, 2004 10:33 am
Posts: 16
Location: Bavaria/Germany
I did further investigations and discovered when PlotMovement is enabled and you do NOT close the fleet window FO does not crash ... as soon as you close the fleet window and move the mouse over a system it crashes adding debug code showed that the crash occurs somewhere in this lines of code as the message at the beginning is shown but the next isn't and there isn't any code outside the if clause:

UI/FleetWnd.cpp:

Code:
Logger().errorStream() << "For loop run: " << forloop_run;
            forloop_run++;
            Fleet* fleet = FleetInRow(*it);
            if (fleet->OwnedBy(empire_id) && fleet->NumShips()) {
                Logger().errorStream() << "Fleet is of own empire";



Commandline output is:

1172780679 ERROR : For loop run: 0
1172780679 ERROR : main() caught exception(std::exception): vector::_M_range_check
[Thread -1243731056 (LWP 15469) exited]
[Thread -1235338352 (LWP 15468) exited]
1172780679 FATAL : Initiating Exit (code 1 - error termination)
1172780679 DEBUG : SDLQuit() complete.
1172780679 FATAL : Initiating Exit (code 1 - error termination)
1172780679 DEBUG : SDLQuit() complete.
1172780679 FATAL : Initiating Exit (code 1 - error termination)
[Thread -1273308272 (LWP 15471) exited]
1172780679 DEBUG : SDLQuit() complete.
1172780679 FATAL : Initiating Exit (code 1 - error termination)
1172780679 DEBUG : SDLQuit() complete.
[Thread -1252213872 (LWP 15470) exited]

backtrace report isn't of any use as the cought exception does clean up the stack:
Code:


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 01, 2007 10:48 pm 
Offline
Compilation Expert
User avatar

Joined: Thu Jul 06, 2006 10:30 pm
Posts: 219
Location: Russia/Moscow
sapier wrote:
backtrace report isn't of any use as the cought exception does clean up the stack

You can get useful backtrace if you catch the exception manually with gdb:
Code:
$ gdb freeorion
(gdb) start
(gdb) catch throw
(gdb) continue
Reproduce the crash.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 01, 2007 11:52 pm 
Offline
Space Floater

Joined: Sat Oct 16, 2004 10:33 am
Posts: 16
Location: Bavaria/Germany
I did what lonlycyborg said and discovered that there are some exceptions bevor that but those are catched without exiting. Last Function is a GG function probably i was looking at the wrong place for the bug? Or this are two different bugs as in this case the segfault is in FleetInRow and in the initial bug its in PlotMovement.... if thats the case those two bugs are quite similar in their occurence in the ui

bt of the exiting exception is:

#0 0xb7778855 in __cxa_throw () from /usr/lib/libstdc++.so.6
#1 0xb770c4ff in std::__throw_out_of_range () from /usr/lib/libstdc++.so.6
#2 0xb7c30932 in GG::ListBox::GetRow () from /opt/freeorion/lib/libGiGi.so
#3 0x0828c2ce in FleetWnd::FleetInRow ()
#4 0x0828d4c2 in FleetWnd::PlotMovement ()
#5 0x0828de5c in FleetWnd::SystemBrowsed ()
#6 0x0823c1b3 in boost::function1<void, int, std::allocator<void> >::operator() ()
#7 0x0823c36a in boost::operator++<boost::signals::detail::slot_call_iterator<boost::signals::detail::call_bound1<void>::caller<int, boost::function<void ()(int), std::allocator<void> > >, boost::signals::detail::named_slot_map_iterator>, boost::signals::detail::unusable, boost::single_pass_traversal_tag, boost::signals::detail::unusable const&, int> ()
#8 0x0823c7b8 in boost::signal1<void, int, boost::last_value<void>, int, std::less<int>, boost::function<void ()(int), std::allocator<void> > >::operator() ()
#9 0x08319040 in MapWnd::MouseEnteringSystem ()
#10 0x0823c1b3 in boost::function1<void, int, std::allocator<void> >::operator() ()
#11 0x0823c36a in boost::operator++<boost::signals::detail::slot_call_iterator<boost::signals::detail::call_bound1<void>::caller<int, boost::function<void ()(int), std::allocator<void> > >, boost::signals::detail::named_slot_map_iterator>, boost::signals::detail::unusable, boost::single_pass_traversal_tag, boost::signals::detail::unusable const&, int> ()
#12 0x0823c7b8 in boost::signal1<void, int, boost::last_value<void>, int, std::less<int>, boost::function<void ()(int), std::allocator<void> > >::operator() ()
#13 0x08380a1c in SystemIcon::MouseEnter ()
#14 0xb7c8b203 in GG::Wnd::HandleEvent () from /opt/freeorion/lib/libGiGi.so
#15 0xb7c18554 in GG::GUI::CheckedGetWindowUnder () from /opt/freeorion/lib/libGiGi.so
#16 0xb7c1aa21 in GG::GUI::HandleGGEvent () from /opt/freeorion/lib/libGiGi.so
#17 0xb7ef9ec5 in SDLGUI::HandleSystemEvents () from /opt/freeorion/lib/libGiGiSDL.so
#18 0xb7c00ea8 in GG::EventPump::operator() () from /opt/freeorion/lib/libGiGi.so
#19 0xb7efa2e4 in SDLGUI::Run () from /opt/freeorion/lib/libGiGiSDL.so
#20 0xb7c16a51 in GG::GUI::operator() () from /opt/freeorion/lib/libGiGi.so
#21 0xb7efa0ad in SDLGUI::operator() () from /opt/freeorion/lib/libGiGiSDL.so
#22 0x082150c0 in main ()


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 02, 2007 12:12 am 
Offline
Programming, Design, and De Facto Lead
User avatar

Joined: Wed Oct 08, 2003 1:33 am
Posts: 7890
Location: Vancouver, BC
It might be related to signals not being automatically disconnected when the FleetWnd is closed. I don't have the code with me to check, but I think that was roughly what the Boost bug was about. So, there's probably some signal being emitted when the SystemIcon on the MapWnd is moused over, and that signal is connected to something in the open FleetWnd object, directly or indirectly. When the FleetWnd is closed, the object is probably destroyed, and the signals should automatically be disconnected, but aren't. So then, you mouse over a system, the connected-to FleetWnd function is called with an invalid this pointer, and eventually you get a crash when trying to access member variables? Or perhaps just the ListBox in the FleetWnd is emptied and the rows destroyed wen the FleetWnd is closed, but the connection to the FleetWnd with a parameter that is the index into the ListBox for a particular row (fleet), isn't disconnected (hence the out of range exception in GG::ListBox::GetRow)? Either disconnecting that signal manually, or putting a check on the passed index (if that's the case) so an invalid row isn't indexed might help...

That was a lot of hard-to-digest text, I guess...


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 02, 2007 11:57 am 
Offline
Space Floater

Joined: Sat Oct 16, 2004 10:33 am
Posts: 16
Location: Bavaria/Germany
ok I think I got what you meant but there are still some questions:

1. the crash occurs on mouse over ANY system not just that one the fleet was in oder was going to

2. Without a visible fleet window in UI should threre even be a FleetWnd Object that can call PlotMovement?


If answer is no this is nearly sure the boost signal bug as it indicates a function call in an already deleted member.

Is anyone working at this problem? I saw that last update of boost was december 2005 for the first look it seems that boost is dead ... that would be really sad fof FO as both removing boost from fo and working around those bugs are likely to be a huge load of work


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 02, 2007 12:12 pm 
Offline
Space Floater

Joined: Sat Oct 16, 2004 10:33 am
Posts: 16
Location: Bavaria/Germany
ok I give up last discovery I did is that it's not connected to moving the fleet at all it's as simple as opening a fleet window closing it and moving mouse over a system

that obviously indicates that this is the so called boost bug which seems to render FO linux useless please post a warning somewhere on the fo page to prevent others of finding this boost bug again and again ;-(


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 02, 2007 1:56 pm 
Offline
Programming, Design, and De Facto Lead
User avatar

Joined: Wed Oct 08, 2003 1:33 am
Posts: 7890
Location: Vancouver, BC
I'm pretty sure Boost is not dead... it's quite a large project, and it looks like parts of it are going to be incorporated into the C++ standard. There are CVS changes in the last few weeks, and there are is apparently a BoostCon planned for 2007.

Anyway, I'm going to attempt to move around some of the signals connections and such in an attempt to fix or work around this particular manifestation of the problem.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 02, 2007 3:19 pm 
Offline
Space Floater

Joined: Sat Oct 16, 2004 10:33 am
Posts: 16
Location: Bavaria/Germany
Ok that's rather good news about boost :-) hope they are going to release updates sooner in the near future ;-)

The question is in wich of the many C++ "Standards" it will be incorporated ;-)

Thx for your tries to fix the signal bugs I hope you succede :-)


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 09, 2007 2:42 pm 
Offline
Programming, Design, and De Facto Lead
User avatar

Joined: Wed Oct 08, 2003 1:33 am
Posts: 7890
Location: Vancouver, BC
OK, I've reorganized how the FleetWnd, FleetButton and MapWnd stuff is laid out and interacts. This probably introduced a few Linux compile bugs, but once those are worked out, I'd like to see if it helped at all with the PlotMovement and and Ship-Drag Fleet-Delete bugs.

So please update, recompile and let me know. Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Mar 10, 2007 11:12 am 
Offline
Compilation Expert
User avatar

Joined: Thu Jul 06, 2006 10:30 pm
Posts: 219
Location: Russia/Moscow
"Close fleet window and point to any star" crash is fixed :) . Now it crashes when I drag any ship to new fleet :( .


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 52 posts ]  Go to page 1, 2, 3, 4  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group