MantisBT - VCMI
View Issue Details
0002322VCMIMechanics - Battlespublic2015-11-01 01:342024-01-30 19:18
SXX 
 
normalcrashrandom
closedopen 
0.98d 
 
0002322: Crash after battle finished
New bug within current develop that I can't 100% reproduce yet. For sure it's looks like appear more often when magic was used in battle.

Current commit: 34cc9c78f7c6bfc7c3b61f84022bcd7e23db7504
0	__GI_raise	/usr/lib/debug/lib/x86_64-linux-gnu/libc-2.19.so	56	0x7ffff2acdcc9	
1	__GI_abort	/usr/lib/debug/lib/x86_64-linux-gnu/libc-2.19.so	89	0x7ffff2ad10d8	
2	__assert_fail_base	/usr/lib/debug/lib/x86_64-linux-gnu/libc-2.19.so	92	0x7ffff2ac6b86	
3	__GI___assert_fail	/usr/lib/debug/lib/x86_64-linux-gnu/libc-2.19.so	101	0x7ffff2ac6c32	
4	boost::condition_variable::~condition_variable	condition_variable_fwd.hpp	81	0x59ec71	
5	CondSh<BattleAction *>::~CondSh	CBattleInterface.h	32	0x599d03	
6	CBattleInterface::~CBattleInterface	CBattleInterface.cpp	436	0x57f212	
7	CBattleInterface::~CBattleInterface	CBattleInterface.cpp	405	0x57fbb9	
8	CGuiHandler::popInts	CGuiHandler.cpp	133	0x6078a0	
9	CBattleResultWindow::bExitf	CBattleInterfaceClasses.cpp	481	0x5d8441	
10	CBattleResultWindow::CBattleResultWindow(BattleResult const&, SDL_Rect const&, CPlayerInterface&)::$_6::operator()() 
const	CBattleInterfaceClasses.cpp	329	0x5db748	
11	std::_Function_handler<void (), CBattleResultWindow::CBattleResultWindow(BattleResult const&, 
SDL_Rect const&, CPlayerInterface&)::$_6>::_M_invoke(std::_Any_data const&)	functional	
2071	0x5db5bd	
12	std::function<void ()>::operator()() const	functional	2471	0x5a11ae	
13	CFunctionList<void ()>::operator()<>() const	FunctionList.h	62	0x5e3d9c	
14	CButton::onButtonClicked	Buttons.cpp	163	0x63d89c	
15	CButton::clickLeft	Buttons.cpp	188	0x63da57	
16	virtual thunk to CButton::clickLeft(boost::logic::tribool, bool)	Buttons.cpp	166	0x63daa7	
17	CGuiHandler::handleEvent	CGuiHandler.cpp	308	0x608d38	
18	CGuiHandler::handleEvents	CGuiHandler.cpp	182	0x607b77	
19	CPlayerInterface::update	CPlayerInterface.cpp	1621	0x97cb99	
20	non-virtual thunk to CPlayerInterface::update()	CPlayerInterface.cpp	1596	0x97cc69	
21	CGuiHandler::renderFrame	CGuiHandler.cpp	414	0x609659	
22	mainLoop	CMT.cpp	1099	0x92f8c7	
23	main	CMT.cpp	484	0x92b5b2	
R1
txt VCMI_Client_log.txt (951,347) 2015-11-01 08:19
https://bugs.vcmi.eu/file_download.php?file_id=2387&type=bug
Issue History
2015-11-01 01:34SXXNew Issue
2015-11-01 07:22AVSNote Added: 0006070
2015-11-01 08:19SXXFile Added: VCMI_Client_log.txt
2016-01-25 18:31AVSNote Added: 0006362
2016-01-25 18:31AVSStatusnew => acknowledged
2022-03-22 16:24PovelitelTag Attached: R1
2023-04-12 17:06IvanStatusacknowledged => confirmed
2023-04-12 17:06IvanNote Added: 0008567
2024-01-30 19:18IvanNote Added: 0008914
2024-01-30 19:18IvanStatusconfirmed => closed

Notes
(0006070)
AVS   
2015-11-01 07:22   
Need trace log before crush, I think this depends on last actions in battle. Also this may be not "new" issue.
(0006362)
AVS   
2016-01-25 18:31   
So it fails on assert in

        ~condition_variable()
        {
            int ret;
#if defined BOOST_THREAD_PROVIDES_INTERRUPTIONS
            do {
              ret = pthread_mutex_destroy(&internal_mutex);
            } while (ret == EINTR);
            BOOST_ASSERT(!ret); //<<<<here
#endif
            do {
              ret = pthread_cond_destroy(&cond);
            } while (ret == EINTR);
            BOOST_ASSERT(!ret);
        }

I suspect that ret == EBUSY, because mutex is still locked by "activeStack" thread, (CPlayerInterface::activeStack CPlayerInterface.cpp 816).

IOW it is a race condition. CBattleInterface destructor should wait "activeStack" thread to finish.
(0008567)
Ivan   
2023-04-12 17:06   
Migrated to github, status will be tracked here:
https://github.com/vcmi/vcmi/issues/1219 [^]
(0008914)
Ivan   
2024-01-30 19:18   
Closing issues that were migrated to Github