提交 642df0ee 编写于 作者: A Alexis Campailla

Minor fixes in VectoredHeapMapper

Fixed boundary check heapEnd
Improved logging
上级 9e7b21ca
......@@ -613,12 +613,12 @@ BOOL QForkMasterInit( __int64 maxheapBytes ) {
}
LONG CALLBACK VectoredHeapMapper(PEXCEPTION_POINTERS info) {
if( info->ExceptionRecord->ExceptionCode == STATUS_ACCESS_VIOLATION &&
if (info->ExceptionRecord->ExceptionCode == STATUS_ACCESS_VIOLATION &&
info->ExceptionRecord->NumberParameters == 2) {
intptr_t failingMemoryAddress = info->ExceptionRecord->ExceptionInformation[1];
intptr_t heapStart = (intptr_t)g_pQForkControl->heapStart;
intptr_t heapEnd = heapStart + ((SIZE_T)g_pQForkControl->availableBlocksInHeap * g_pQForkControl->heapBlockSize);
if( failingMemoryAddress >= heapStart && failingMemoryAddress <= heapEnd )
if (failingMemoryAddress >= heapStart && failingMemoryAddress < heapEnd)
{
intptr_t startOfMapping = failingMemoryAddress - failingMemoryAddress % g_systemAllocationGranularity;
intptr_t mmfOffset = startOfMapping - heapStart;
......@@ -634,6 +634,7 @@ LONG CALLBACK VectoredHeapMapper(PEXCEPTION_POINTERS info) {
LODWORD(mmfOffset),
bytesToMap,
(LPVOID)startOfMapping);
if(pMapped != NULL)
{
return EXCEPTION_CONTINUE_EXECUTION;
......@@ -641,15 +642,15 @@ LONG CALLBACK VectoredHeapMapper(PEXCEPTION_POINTERS info) {
else
{
DWORD err = GetLastError();
::redisLog(REDIS_WARNING, "\nF(0x%p)", startOfMapping);
::redisLog(REDIS_WARNING, "\t MapViewOfFileEx failed with error 0x%08X. \n", err);
::redisLog(REDIS_WARNING, "MapViewOfFileEx failed with error 0x%08X.\n", err);
::redisLog(REDIS_WARNING, "\t startOfMapping 0x%p", startOfMapping);
::redisLog(REDIS_WARNING, "\t heapStart 0x%p\n", heapStart);
::redisLog(REDIS_WARNING, "\t heapEnd 0x%p\n", heapEnd);
::redisLog(REDIS_WARNING, "\t failing access location 0x%p\n", failingMemoryAddress);
::redisLog(REDIS_WARNING, "\t offset into mmf to start mapping 0x%016X\n", mmfOffset);
::redisLog(REDIS_WARNING, "\t start of new mapping 0x%p \n", startOfMapping);
::redisLog(REDIS_WARNING, "\t bytes to map 0x%08x \n", bytesToMap);
::redisLog(REDIS_WARNING, "\t continuing exception handler search \n");
::redisLog(REDIS_WARNING, "\t offset into mmf to start mapping 0x%p\n", mmfOffset);
::redisLog(REDIS_WARNING, "\t start of new mapping 0x%p\n", startOfMapping);
::redisLog(REDIS_WARNING, "\t bytes to map 0x%p\n", bytesToMap);
::redisLog(REDIS_WARNING, "\t continuing exception handler search\n");
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册