ReadContentDefinition sample hangs on DWFContent::load(); call. Mac OS X 10.7
pContent->load();
Not all files cause this hanging. The one that does is attached.
I've checked this file on Windows and it was opened fine.
It hangs somewhere in DWFCore library at: DWFThreadMutex::lock()
The application can't lock mutex and hangs indefinitely.
I've compiled DWFCore and DWFToolkit libraries first, then sample. I'm compiling with default settings provided in toolkit with latest XCode 4.5.2. Build settings I changed are
Compiler: LLVM GCC 4.2
Base SDK: 10.7
I am running into the same problem on Ubuntu Linux 14.04, gcc 4.8 and DWF Toolkit 7.7.
Here is the stacktrace
__lll_lock_wait () _L_lock_909 () __GI___pthread_mutex_lock (mutex=0x625080) DWFCore::DWFThreadMutex::lock (this=0x625070) DWFCore::_scoped_lock::_scoped_lock (this=0x7fffffffac20, pMutex=@0x625070: {<DWFCore::DWFSynchronization> = {_vptr.DWFSynchronization = 0x7ffff7bb0a70 <vtable for DWFCore::DWFThreadMutex+16>}, _bInit = true, _tMutex = {__data = {__lock = 2, __count = 0, __owner = 10006, __nusers = 1, __kind = 0, __spins = 0, __elision = 0, __list = {__prev = 0x0, __next = 0x0}}, __size = \"\\002\\000\\000\\000\\000\\000\\000\\000\\026'\\000\\000\\001\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\\000\", __align = 2}}) DWFCore::DWFMemoryManager::release (this=0x7ffff7bb9600 <DWFCore::DWFMemoryManager::Instance()::kInstance>, p=0x7ffff7f9a020) DWFCore::DWFMemoryManager::tInfoHolderBase::release (this=0x624ea8, pInfo=0x7ffff7f9a020) DWFCore::DWFProxy<DWFToolkit::DWFProperty::tPropertyContent, std::allocator<DWFToolkit::DWFProperty::tPropertyContent>, DWFToolkit::DWFProperty::tPropertyArchive>::tInfoHolderImp::dispose (this=0x624ea8) DWFCore::DWFProxy<DWFToolkit::DWFProperty::tPropertyContent, std::allocator<DWFToolkit::DWFProperty::tPropertyContent>, DWFToolkit::DWFProperty::tPropertyArchive>::tInfoHolderImp::pageOut (this=0x624ea8) DWFCore::DWFNruStrategy::onAcquire (this=0x7ffff7bb95c0 <DWFCore::DWFMemoryManager::DWFMemoryManager()::oStrategy>, rTableInfo=@0x7ffff7bb9600: {_pBlockHead = 0x20baf70, _pFreeHead = 0x20bafb8, _pUsedHead = 0x20baf80, _nUsedCount = 4095, _nFreeCount = 4093, _nHighWater = 4094, _nLowWater = 409, _nBlockSize = 4094}) DWFCore::DWFMemoryManager::acquire (this=0x7ffff7bb9600 <DWFCore::DWFMemoryManager::Instance()::kInstance>) DWFCore::DWFMemoryManager::tInfoHolderBase::acquire (this=0x20f3278) DWFCore::DWFProxy<DWFToolkit::DWFProperty::tPropertyContent, std::allocator<DWFToolkit::DWFProperty::tPropertyContent>, DWFToolkit::DWFProperty::tPropertyArchive>::tInfoHolderImp::attach (this=0x20f3278, ptr=0x20f32a0, bDirty=true, hHandle=0) DWFCore::DWFProxy<DWFToolkit::DWFProperty::tPropertyContent, std::allocator<DWFToolkit::DWFProperty::tPropertyContent>, DWFToolkit::DWFProperty::tPropertyArchive>::tInfoHolderImp::pageIn (this=0x20f3278)
Any way to get around this? I noticed that the README for DWF Toolkit says that one of the samples also has problems - "[1] DWFThreadPool does not work stably, hence the Threads sample has 1/3 chance to deadlock or deadloop.".
Hints, suggestions appreciated!
FWIW, I ended up changing the mutex type in mutex.cpp to PTHREAD_MUTEX_ERRORCHECK_NP from the default PTHREAD_MUTEX_FAST_NP, which while faster causes it to block - which can be a problem if the same thread is trying to lock more than once. It solved the deadlock problem. Have to see if there are any side-effects..