MantisBT - VCMI
View Issue Details
0000956VCMIMechanics - Adventure Mappublic2012-05-15 15:252014-05-30 17:41
Ivan 
Tow 
normalcrashsometimes
closedfixed 
x86_64Ubuntu Linux12.04 (precise)
 
 
0000956: Sometimes VCMI hangs on visiting objects by hero
Sometimes (~1 time per in-game month) on visiting adventure map object (so far had happened with water wheel, gold pile and creatures) game hangs:
- Interface won't response
- Music still playing
- Closing client will only print message to console "Sent closing signal to the server"

This is not reproducible after reloading game

Uploaded logs and stacktrace from both client and server.
No tags attached.
zip vcmi-bug-visit-object.zip (69,627) 2012-05-15 15:25
https://bugs.vcmi.eu/file_download.php?file_id=924&type=bug
Issue History
2012-05-15 15:25IvanNew Issue
2012-05-15 15:25IvanFile Added: vcmi-bug-visit-object.zip
2012-05-15 20:43IvanNote Added: 0002443
2012-05-15 20:44IvanNote Edited: 0002443bug_revision_view_page.php?bugnote_id=2443#r1589
2012-05-19 00:07TowAssigned To => Tow
2012-05-19 00:07TowStatusnew => assigned
2012-05-19 23:00TowNote Added: 0002508
2012-05-19 23:01TowStatusassigned => resolved
2012-05-19 23:01TowResolutionopen => fixed
2014-05-30 17:41beegeeStatusresolved => closed

Notes
(0002443)
Ivan   
2012-05-15 20:43   
(edited on: 2012-05-15 20:44)
Got it once more. And I think I found source - deadlock, bit I still have no idea how to fix:

Thread A (GuiHandler::run) stuck here:
3 0x00000000005a19b0 in vstd::unlock_guard<boost::recursive_mutex, vstd::detail::unlock_policy<boost::recursive_mutex> >::~unlock_guard (
    this=0x7ff1ad731820, __in_chrg=<optimized out>)
    at /lib/UnlockGuard.h:72
4 0x0000000000776886 in CPlayerInterface::moveHero (this=0x7ff1a748e220, h=
    0x7ff1a54e8920, path=...)
    at /client/CPlayerInterface.cpp:1254

Thread B (CClient::run) stuck here:
4 0x00007ff1bf4eacb7 in boost::unique_lock<boost::shared_mutex>::unique_lock
    (this=0x7ff1aa971c80, m_=...) at /usr/include/boost/thread/locks.hpp:290
5 0x00007ff1bf4d47e5 in CApplyOnGS<HeroVisit>::applyOnGS (
    this=0x7ff1a5278520, gs=0x7ff1a5322ba0, pack=0x7ff1905859d0)
    at /home/ivan/src/vcmi/lib/CGameState.cpp:77

Any ideas how to fix?

(0002508)
Tow   
2012-05-19 23:00   
Fixed in r2698 by reordering locks. :/
Not very nice, it would be best if I had a lock that atomically locks two (heterogeneous) mutexes. Seems not effort-worthy for now.