crash using boost::interprocess

Hello, I'm using boost::interprocess to share config information between processes on windows platform. It random crash on custom pc. I only have a minidump dump, here is the stack output by windbg: 001df6b0 65e49d45 001df758 00302c48 7721ee1e XXXXPlugin!boost::interprocess::detail::emulation_recursive_mutex::lock+0xc 001df6f8 65e49c42 06750038 65e7b8b4 06750028 XXXXPlugin!boost::interprocess::scoped_lock<boost::interprocess::interprocess_recursive_mutex>::lock+0x15 001df720 65e494c1 06750008 00000001 6c1274eb XXXXPlugin!boost::interprocess::segment_manager<wchar_t,boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family,boost::interprocess::offset_ptr<void>,0>,boost::interprocess::iset_index>:: priv_get_lock+0x42 001df76c 65e48239 65e7b8b4 001df798 001df794 XXXXPlugin!boost::interprocess::segment_manager<wchar_t,boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family,boost::interprocess::offset_ptr<void>,0>,boost::interprocess::iset_index>:: priv_generic_find<wchar_t>+0x31 001df7bc 65e70053 001df7dc 00000001 001df8c4 XXXXPlugin!boost::interprocess::segment_manager<wchar_t,boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family,boost::interprocess::offset_ptr<void>,0>,boost::interprocess::iset_index>:: priv_find_impl<ConfigFile::_CACHE_ITEM>+0xa9 001df800 65e720c8 01ff8670 65e7b8b4 001df8cc XXXXPlugin!ConfigFile::CConfigCache::Read+0xc3 001df82c 65e5bbf5 65e7b8b4 001df8cc 00000004 XXXXPlugin!ConfigFile::CCommonConfig::Read+0x28 001dfb00 65e5e42e 020739b8 001dfb24 65e5e69a XXXXPlugin!CXXXXXMng::bFindProcessInfo+0x55 001dfb0c 65e5e69a 0000001c 001dfba0 00000113 XXXXPlugin!CXXXXXMng::OnTimer+0x5e 001dfb24 756286ef 00020448 00000113 0000001c XXXXPlugin!CXXXXXMng::StaticWndProc+0x2a 001dfb50 75628876 65e5e670 00020448 00000113 user32!InternalCallWinProc+0x23 001dfbc8 756289b5 00000000 65e5e670 00020448 user32!UserCallWinProcCheckWow+0x14b 001dfc28 75628e9c 65e5e670 00000000 001dfc70 user32!DispatchMessageWorker+0x35e 001dfc38 0137cf27 001dfc50 013eb5a8 013eb2d8 user32!DispatchMessageW+0xf 001dfc70 0134b2f5 8b56d422 013eb2d8 013eb2d8 xxxxMain!CXXXX::MessageLoop+0x97 001dfec8 67add2a7 013f11a4 00000001 00000000 xxxxMain!CXXXXApp::InitInstance+0x335 001dfecc 013f11a4 00000001 00000000 013787d8 mfc80u!AfxWinMain+0x48 [f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\winmain.cpp @ 37] 001dff6c 75b41114 7ffda000 001dffb8 7721b495 xxxxMain!__native_startup_lock 001dff78 7721b495 7ffda000 773d0f2e 00000000 kernel32!BaseThreadInitThunk+0xe 001dffb8 7721b468 01378944 7ffda000 00000000 ntdll!__RtlUserThreadStart+0x70 001dffd0 00000000 01378944 7ffda000 00000000 ntdll!_RtlUserThreadStart+0x1b EXCEPTION_RECORD: ffffffff -- (.exr 0xffffffffffffffff) ExceptionAddress: 72341bac (XXXXPlugin!boost::interprocess::detail::emulation_recursive_mutex::lock+0x0000000c) ExceptionCode: c0000005 (Access violation) ExceptionFlags: 00000000 NumberParameters: 2 Parameter[0]: 00000000 Parameter[1]: 06400030 Attempt to read from address 06400030 FOLLOWUP_IP: XXXXPlugin!boost::interprocess::detail::emulation_recursive_mutex::lock+c 65e41bac 8b4608 mov eax,dword ptr [esi+8] the code is: PCACHE_ITEM CacheItem = m_SharedMemory.find<CACHE_ITEM>(lpszName).first; Can anyone help me? thx

El 02/11/2011 8:00, nevergone . escribió:
Hello,
I'm using boost::interprocess to share config information between processes on windows platform. It random crash on custom pc. I only have a minidump dump, here is the stack output by windbg:
It's hard to say, but using experimental detail classes ("emulation_recursive_mutex") is not supported. They are ongoin experiments. Ion

HI, igaztanaga I don't use any of experimental detail classes like("emulation_recursive_mutex"). I'm using wmanaged_windows_shared_memory::find method to find a element, and find method eventually will call emulation_recursive_mutex::lock. The stack cannot see find due to compile optimization. The code is like this: namespace BOOSTIP = ::boost::interprocess; typedef struct _CACHE_ITEM { BOOSTIP::offset_ptr<BYTE> CacheValue; ULONG CacheLength; ULONG CacheMaxLength; volatile BOOL CacheDirty; _CACHE_ITEM() { CacheValue = 0; CacheLength = 0; CacheMaxLength = 0; CacheDirty = FALSE; } } CACHE_ITEM, *PCACHE_ITEM; BOOL CConfigCache::Read(__in LPCTSTR lpszName, __out PVOID lpValue, __in DWORD dwSize, __out_opt PDWORD dwRetSize /*= NULL */) { try { if (CanIAccessCache()) { CScopeGuard<CMutex> guard(m_FunctionLock); // // ....... ignore some useless code // PCACHE_ITEM CacheItem = m_SharedMemory.find <CACHE_ITEM>(lpszName).first; if (CacheItem) { if (dwSize >= CacheItem->CacheLength) { if (dwRetSize) *dwRetSize = CacheItem->CacheLength; if (lpValue && CacheItem->CacheLength && CacheItem->CacheValue) { CopyMemory(lpValue, CacheItem->CacheValue.get(), CacheItem->CacheLength); return DecryptBuffer((LPBYTE)lpValue, CacheItem->CacheLength); } else { return TRUE; } } else if (dwRetSize) { *dwRetSize = CacheItem->CacheLength; return TRUE; } else { return FALSE; } } else { ++m_ReadConfigCacheMissCount; } } return FALSE; } catch (BOOSTIP::interprocess_exception &) { EXCEPTION_OUT("CConfigCache::Read interprocess_exception\n"); MakeCacheInvalid(); return FALSE; } catch (CConfigCacheBaseException &) { EXCEPTION_OUT("CConfigCache::Read CConfigCacheBaseException\n"); MakeCacheInvalid(); return FALSE; } } Program random crash at : PCACHE_ITEM CacheItem = m_SharedMemory.find<CACHE_ITEM>(lpszName).first; I don't know why? 2011/11/3 <igaztanaga@gmail.com>
El 02/11/2011 8:00, nevergone . escribió:
Hello,
I'm using boost::interprocess to share config information between processes on windows platform. It random crash on custom pc. I only have a minidump dump, here is the stack output by windbg:
It's hard to say, but using experimental detail classes ("emulation_recursive_mutex") is not supported. They are ongoin experiments.
Ion ______________________________**_________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/**mailman/listinfo.cgi/boost-**users<http://lists.boost.org/mailman/listinfo.cgi/boost-users>

El 03/11/2011 14:27, nevergone . escribió:
HI, igaztanaga I don't use any of experimental detail classes like("emulation_recursive_mutex"). I'm using wmanaged_windows_shared_memory::find method to find a element, and find method eventually will call emulation_recursive_mutex::lock. The stack cannot see find due to compile optimization.
Sorry, I was confused, I thought it was using robust emulation code. It's impossible to say what's happening if we don't have a crashing example program. Ion

OK, igaztanaga, can you reivew my code? I will send my code to your gmail. thx. 2011/11/4 Ion Gaztañaga <igaztanaga@gmail.com>
El 03/11/2011 14:27, nevergone . escribió:
HI, igaztanaga
I don't use any of experimental detail classes like("emulation_recursive_**mutex"). I'm using wmanaged_windows_shared_**memory::find method to find a element, and find method eventually will call emulation_recursive_mutex::**lock. The stack cannot see find due to compile optimization.
Sorry, I was confused, I thought it was using robust emulation code. It's impossible to say what's happening if we don't have a crashing example program.
Ion ______________________________**_________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/**mailman/listinfo.cgi/boost-**users<http://lists.boost.org/mailman/listinfo.cgi/boost-users>
participants (3)
-
igaztanaga@gmail.com
-
Ion Gaztañaga
-
nevergone .