diff --git a/src/Win32_Interop/Win32_QFork.cpp b/src/Win32_Interop/Win32_QFork.cpp index 68c0b82bde6c287f8811734ed6f2768b18b68154..30073cdf9a9ff9202c75f56f9e9a8b7d67c85e86 100644 --- a/src/Win32_Interop/Win32_QFork.cpp +++ b/src/Win32_Interop/Win32_QFork.cpp @@ -644,15 +644,24 @@ LONG CALLBACK VectoredHeapMapper(PEXCEPTION_POINTERS info) { else { DWORD err = GetLastError(); - ::redisLog(REDIS_WARNING, "MapViewOfFileEx failed with error 0x%08X.\n", err); + ::redisLog(REDIS_WARNING, "\n\n=== REDIS BUG REPORT START: Cut & paste starting from here ==="); + ::redisLog(REDIS_WARNING, "--- FATAL ERROR MAPPING VIEW OF MAP FILE"); + ::redisLog(REDIS_WARNING, "\t MapViewOfFileEx failed with error 0x%08X.", 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%p\n", mmfOffset); - ::redisLog(REDIS_WARNING, "\t start of new mapping 0x%p\n", startOfMapping); + ::redisLog(REDIS_WARNING, "\t heapStart 0x%p", heapStart); + ::redisLog(REDIS_WARNING, "\t heapEnd 0x%p", heapEnd); + ::redisLog(REDIS_WARNING, "\t failing access location 0x%p", failingMemoryAddress); + ::redisLog(REDIS_WARNING, "\t offset into mmf to start mapping 0x%p", mmfOffset); + ::redisLog(REDIS_WARNING, "\t start of new mapping 0x%p", startOfMapping); ::redisLog(REDIS_WARNING, "\t bytes to map 0x%p\n", bytesToMap); - ::redisLog(REDIS_WARNING, "\t continuing exception handler search\n"); + if (err == 0x000005AF) { + ::redisLog(REDIS_WARNING, "The system paging file is too small for this operation to complete."); + ::redisLog(REDIS_WARNING, "See https://github.com/MSOpenTech/redis/wiki/Memory-Configuration"); + ::redisLog(REDIS_WARNING, "for more information on configuring the system paging file for Redis."); + } + ::redisLog(REDIS_WARNING, "\n=== REDIS BUG REPORT END. Make sure to include from START to END. ===\n\n"); + // Call exit to avoid executing the Unhandled Exceptiont Handler since we don't need a call stack + exit(1); } } } @@ -1022,7 +1031,19 @@ OperationStatus GetForkOperationStatus() { } if (WaitForSingleObject(g_pQForkControl->forkedProcessReady, 0) == WAIT_OBJECT_0) { - return OperationStatus::osINPROGRESS; + // Verify if the child process is still running + if (WaitForSingleObject(g_hForkedProcess, 0) == WAIT_OBJECT_0) { + // The child process is not running, close the handle and report the status + // setting the operationFailed event + g_hForkedProcess = 0; + CloseHandle(g_hForkedProcess); + if (g_pQForkControl->operationFailed != NULL) { + SetEvent(g_pQForkControl->operationFailed); + } + return OperationStatus::osFAILED; + } else { + return OperationStatus::osINPROGRESS; + } } return OperationStatus::osUNSTARTED; diff --git a/src/Win32_Interop/Win32_StackTrace.cpp b/src/Win32_Interop/Win32_StackTrace.cpp index 9ace42adfa83b941650ceae7412e0a237a1c3b8a..02b5bcc685d980cff3d7ff34ba9472b5f4a83562 100644 --- a/src/Win32_Interop/Win32_StackTrace.cpp +++ b/src/Win32_Interop/Win32_StackTrace.cpp @@ -31,6 +31,7 @@ static IMAGEHLP_LINE64 line; static BOOLEAN processingException = FALSE; static CHAR modulePath[MAX_PATH]; static BOOL symbolsInitialized = FALSE; +static LPTOP_LEVEL_EXCEPTION_FILTER defaultTopLevelExceptionHandler = NULL; static const char* exceptionDescription(const DWORD& code) { @@ -163,9 +164,9 @@ void ServerInfo() { void BugReportEnd(){ redisLogRaw(REDIS_WARNING, "\n=== REDIS BUG REPORT END. Make sure to include from START to END. ===\n\n" - " Please report the bug following the instructions on:\n\n" - " http://github.com/MSOpenTech/redis/wiki/Submit-Bug\n\n" - " Suspect RAM error? Use redis-server --test-memory to verify it.\n\n" + " Please report this bug by following the instructions at:\n\n" + " http://github.com/MSOpenTech/redis/wiki/Submitting-an-Issue\n\n" + " Suspect RAM error? Use redis-server --test-memory to verify it.\n\n" ); } @@ -175,11 +176,6 @@ LONG WINAPI UnhandledExceptiontHandler(PEXCEPTION_POINTERS info) { processingException = true; if (info->ExceptionRecord != NULL && info->ExceptionRecord->ExceptionCode != NULL) { exDescription = exceptionDescription(info->ExceptionRecord->ExceptionCode); - // If it's an application exception don't process it, here we don't want to catch - // exceptions like the one thrown by the code that processes the command arguments - if (strcmp(exDescription, "UNKNOWN EXCEPTION") == 0) { - return EXCEPTION_CONTINUE_SEARCH; - } } // Call antirez routine to log the start of the bug report @@ -190,6 +186,11 @@ LONG WINAPI UnhandledExceptiontHandler(PEXCEPTION_POINTERS info) { BugReportEnd(); processingException = false; } + + if (defaultTopLevelExceptionHandler != NULL) { + defaultTopLevelExceptionHandler(info); + } + return EXCEPTION_CONTINUE_SEARCH; } @@ -216,7 +217,7 @@ void InitSymbols() { void StackTraceInit(void) { InitSymbols(); // Global handler for unhandled exceptions - SetUnhandledExceptionFilter(UnhandledExceptiontHandler); + defaultTopLevelExceptionHandler = SetUnhandledExceptionFilter(UnhandledExceptiontHandler); // Handler for abort() signal(SIGABRT, &AbortHandler); } diff --git a/src/Win32_Interop/Win32_dlmalloc.c b/src/Win32_Interop/Win32_dlmalloc.c index 5d8723e78a35c602441da38bc0d98f115470916e..fded58030d7e556bb80b3b6dc87081fe78f85c57 100644 --- a/src/Win32_Interop/Win32_dlmalloc.c +++ b/src/Win32_Interop/Win32_dlmalloc.c @@ -1702,11 +1702,6 @@ static FORCEINLINE void* win32mmap(size_t size) { #else void* ptr = VirtualAlloc(0, size, MEM_RESERVE|MEM_COMMIT, PAGE_READWRITE); #endif - // Avoid printing on the std out - //if( ptr == NULL ) - //{ - // printf( "VirtualAlloc/COWAlloc fail!\n"); - //} return (ptr != 0)? ptr: MFAIL; } @@ -1717,11 +1712,6 @@ static FORCEINLINE void* win32direct_mmap(size_t size) { #else void* ptr = VirtualAlloc(0, size, MEM_RESERVE|MEM_COMMIT|MEM_TOP_DOWN, PAGE_READWRITE); #endif - // Avoid printing on the std out - //if( ptr == NULL ) - //{ - // printf( "VirtualAlloc/COWAlloc fail!\n"); - //} return (ptr != 0)? ptr: MFAIL; }