From 13fbb84d7347befa11a391bd9ef795cc03742d87 Mon Sep 17 00:00:00 2001 From: Vitalii Koshura Date: Fri, 21 Jul 2017 03:39:47 +0300 Subject: [PATCH] Manager: get rid of out_of_range exception and handle such situation in a more graceful way. Original email from Juha Sointusalo : Manager built from master 05172b81, about the same as 7.8.0. Debug build, with wxWidgets asserts directed to log file and BOINC's own crash handler disabled. I was scrolling Event Log when debugger popped up. Should it make any difference, I had gui_rpc_debug enabled and because of that the Event Log had new messages coming in all the time. Continuing from the assert would have crashed Manager. -Juha (21b4.240c): Break instruction exception - code 80000003 (!!! second chance !!!) *** WARNING: Unable to verify checksum for C:\BOINC\boincmgr.exe MSVCP120D!std::_Debug_message+0x46: 00007ffd`3e4d65d6 cc int 3 0:000> kP # Child-SP RetAddr Call Site 00 000000fb`92af9e60 00007ff7`097282d4 MSVCP120D!std::_Debug_message( wchar_t * message = 0x00007ff7`0a0a9210 "deque iterator not dereferencable", wchar_t * file = 0x00007ff7`0a0a9110 "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\deque", unsigned int line = 0x14a)+0x46 [f:\dd\vctools\crt\crtw32\stdcpp\stdthrow.cpp @ 15] 01 000000fb`92af9ea0 00007ff7`09728428 boincmgr!std::_Deque_const_iterator > >::operator*(void)+0x84 [c:\program files (x86)\microsoft visual studio 12.0\vc\include\deque @ 331] 02 000000fb`92af9f00 00007ff7`0972b996 boincmgr!std::_Deque_iterator > >::operator*(void)+0x28 [c:\program files (x86)\microsoft visual studio 12.0\vc\include\deque @ 604] 03 000000fb`92af9f30 00007ff7`0971baf5 boincmgr!std::deque >::at( unsigned int64 _Pos = 0x1b)+0xa6 [c:\program files (x86)\microsoft visual studio 12.0\vc\include\deque @ 1381] 04 000000fb`92af9fc0 00007ff7`0962f734 boincmgr!CMainDocument::message( unsigned int i = 0x1b)+0x65 [c:\dev\boinc\src\clientgui\maindocument.cpp @ 2116] 05 000000fb`92afa030 00007ff7`0962df80 boincmgr!CDlgEventLog::FormatProjectName( int item = 0n27, class wxString * strBuffer = 0x000000fb`92afa0f8)+0x64 [c:\dev\boinc\src\clientgui\dlgeventlog.cpp @ 1018] 06 000000fb`92afa0d0 00007ff7`096337f0 boincmgr!CDlgEventLog::OnListGetItemText( long item = 0n27, long column = 0n0)+0xd0 [c:\dev\boinc\src\clientgui\dlgeventlog.cpp @ 965] 07 000000fb`92afa170 00007ff7`0994652d boincmgr!CDlgEventLogListCtrl::OnGetItemText( long item = 0n27, long column = 0n0)+0x130 [c:\dev\boinc\src\clientgui\dlgeventloglistctrl.cpp @ 123] 08 000000fb`92afa1c0 00007ff7`098e1a8b boincmgr!wxListCtrl::MSWOnNotify( int idCtrl = 0n6403, int64 lParam = 0n1080497781776, int64 * result = 0x000000fb`92afaa48)+0x12cd [c:\src\sdks\wx302\src\msw\listctrl.cpp @ 2511] 09 000000fb`92afa9b0 00007ff7`098db872 boincmgr!wxWindow::HandleNotify( int idCtrl = 0n6403, int64 lParam = 0n1080497781776, int64 * result = 0x000000fb`92afaa48)+0x7b [c:\src\sdks\wx302\src\msw\window.cpp @ 3832] 0a 000000fb`92afaa00 00007ff7`098dcfcb boincmgr!wxWindow::MSWHandleMessage( int64 * result = 0x000000fb`92afb408, unsigned int message = 0x4e, unsigned int64 wParam = 0x1903, int64 lParam = 0n1080497781776)+0x962 [c:\src\sdks\wx302\src\msw\window.cpp @ 3047] 0b 000000fb`92afb3d0 00007ff7`098f7d33 boincmgr!wxWindow::MSWWindowProc( unsigned int message = 0x4e, unsigned int64 wParam = 0x1903, int64 lParam = 0n1080497781776)+0x8b [c:\src\sdks\wx302\src\msw\window.cpp @ 3645] 0c 000000fb`92afb590 00007ff7`0990ce6e boincmgr!wxTopLevelWindowMSW::MSWWindowProc( unsigned int message = 0x4e, unsigned int64 wParam = 0x1903, int64 lParam = 0n1080497781776)+0x263 [c:\src\sdks\wx302\src\msw\toplevel.cpp @ 467] 0d 000000fb`92afb640 00007ff7`098e3052 boincmgr!wxDialog::MSWWindowProc( unsigned int message = 0x4e, unsigned int64 wParam = 0x1903, int64 lParam = 0n1080497781776)+0x13e [c:\src\sdks\wx302\src\msw\dialog.cpp @ 436] 0e 000000fb`92afb690 00007ffd`66151c24 boincmgr!wxWndProc( struct HWND__ * hWnd = 0x00000000`003703f8, unsigned int message = 0x4e, unsigned int64 wParam = 0x1903, int64 lParam = 0n1080497781776)+0x252 [c:\src\sdks\wx302\src\msw\window.cpp @ 2711] 0f 000000fb`92afb850 00007ffd`6615125e USER32!UserCallWinProcCheckWow+0x274 10 000000fb`92afb9b0 00007ffd`66150ff5 USER32!SendMessageWorker+0x20e 11 000000fb`92afba40 00007ffd`57d74df6 USER32!SendMessageW+0x105 12 000000fb`92afbaa0 00007ffd`57d75464 COMCTL32!CCSendNotify+0xf6 13 000000fb`92afbbb0 00007ffd`57ed1146 COMCTL32!CLVItemStore::OnGetItem+0x274 14 000000fb`92afbd80 00007ffd`57ed0fc4 COMCTL32!CLVDrawItemManager::ComputeTextWidth+0xa2 15 000000fb`92afc040 00007ffd`57dc32b3 COMCTL32!CLVIconView::IsItemUnfolded2+0x228 16 000000fb`92afca40 00007ffd`57d78a2d COMCTL32!`DuiTelemetry::Instance'::`2'::`dynamic atexit destructor for 'wrapper''+0x10bf3 17 000000fb`92afdc00 00007ffd`57d765a2 COMCTL32!CListView::WndProc+0x57d 18 000000fb`92afde60 00007ffd`66151c24 COMCTL32!CListView::s_WndProc+0x72 19 000000fb`92afded0 00007ffd`661517bb USER32!UserCallWinProcCheckWow+0x274 1a 000000fb`92afe030 00007ffd`57d687e0 USER32!CallWindowProcW+0x8b 1b 000000fb`92afe080 00007ffd`57d688fa COMCTL32!CallNextSubclassProc+0xb0 1c 000000fb`92afe150 00007ffd`57d68682 COMCTL32!CallNextSubclassProc+0x1ca 1d 000000fb`92afe220 00007ffd`66151c24 COMCTL32!MasterSubclassProc+0xa2 1e 000000fb`92afe2c0 00007ffd`661517bb USER32!UserCallWinProcCheckWow+0x274 1f 000000fb`92afe420 00007ff7`098dd202 USER32!CallWindowProcW+0x8b 20 000000fb`92afe470 00007ff7`098dd129 boincmgr!wxWindow::MSWDefWindowProc( unsigned int nMsg = 0x4e, unsigned int64 wParam = 0, int64 lParam = 0n1080497794320)+0x92 [c:\src\sdks\wx302\src\msw\window.cpp @ 2270] 21 000000fb`92afe550 00007ff7`0994794b boincmgr!wxWindow::MSWWindowProc( unsigned int message = 0x4e, unsigned int64 wParam = 0, int64 lParam = 0n1080497794320)+0x1e9 [c:\src\sdks\wx302\src\msw\window.cpp @ 3651] 22 000000fb`92afe710 00007ff7`098e3052 boincmgr!wxListCtrl::MSWWindowProc( unsigned int nMsg = 0x4e, unsigned int64 wParam = 0, int64 lParam = 0n1080497794320)+0xab [c:\src\sdks\wx302\src\msw\listctrl.cpp @ 3061] 23 000000fb`92afe750 00007ffd`66151c24 boincmgr!wxWndProc( struct HWND__ * hWnd = 0x00000000`0025090c, unsigned int message = 0x4e, unsigned int64 wParam = 0, int64 lParam = 0n1080497794320)+0x252 [c:\src\sdks\wx302\src\msw\window.cpp @ 2711] 24 000000fb`92afe910 00007ffd`6615125e USER32!UserCallWinProcCheckWow+0x274 25 000000fb`92afea70 00007ffd`66150ff5 USER32!SendMessageWorker+0x20e 26 000000fb`92afeb00 00007ffd`57d74df6 USER32!SendMessageW+0x105 27 000000fb`92afeb60 00007ffd`57d9162d COMCTL32!CCSendNotify+0xf6 28 000000fb`92afec70 00007ffd`57d5624d COMCTL32!SendNotifyEx+0x6d 29 000000fb`92afece0 00007ffd`57d5613b COMCTL32!CToolTipsMgr::DoGetDispInfo+0xb9 2a 000000fb`92afee30 00007ffd`57d56018 COMCTL32!CToolTipsMgr::SetCurToolDispInfo+0x33 2b 000000fb`92afee70 00007ffd`57d55f75 COMCTL32!CToolTipsMgr::DoShowBubble+0x90 2c 000000fb`92afef50 00007ffd`57d55f17 COMCTL32!CToolTipsMgr::ShowBubbleForTool+0x35 2d 000000fb`92afef80 00007ffd`57d6a2a6 COMCTL32!CToolTipsMgr::HandleTimer+0x83 2e 000000fb`92afefb0 00007ffd`57d69be6 COMCTL32!CToolTipsMgr::ToolTipsWndProc+0x4e6 2f 000000fb`92aff1e0 00007ffd`66151c24 COMCTL32!CToolTipsMgr::s_ToolTipsWndProc+0x66 30 000000fb`92aff230 00007ffd`6615156c USER32!UserCallWinProcCheckWow+0x274 31 000000fb`92aff390 00007ffd`661542ff USER32!DispatchMessageWorker+0x1ac 32 000000fb`92aff410 00007ff7`09a1df97 USER32!IsDialogMessageW+0x10f 33 000000fb`92aff470 00007ff7`09a1deab boincmgr!wxGUIEventLoop::PreProcessMessage( struct tagMSG * msg = 0x000000fb`92aff528 {msg=0x113 wp=0x1 lp=0x0})+0xb7 [c:\src\sdks\wx302\src\msw\evtloop.cpp @ 97] 34 000000fb`92aff4c0 00007ff7`09a1e3b9 boincmgr!wxGUIEventLoop::ProcessMessage( struct tagMSG * msg = 0x000000fb`92aff528 {msg=0x113 wp=0x1 lp=0x0})+0x3b [c:\src\sdks\wx302\src\msw\evtloop.cpp @ 166] 35 000000fb`92aff4f0 00007ff7`097fb6d6 boincmgr!wxGUIEventLoop::Dispatch(void)+0x299 [c:\src\sdks\wx302\src\msw\evtloop.cpp @ 232] 36 000000fb`92aff5e0 00007ff7`097fb57d boincmgr!wxEventLoopManual::ProcessEvents(void)+0x66 [c:\src\sdks\wx302\src\common\evtloopcmn.cpp @ 173] 37 000000fb`92aff620 00007ff7`097fb06d boincmgr!wxEventLoopManual::DoRun(void)+0xbd [c:\src\sdks\wx302\src\common\evtloopcmn.cpp @ 206] 38 000000fb`92aff6c0 00007ff7`09774272 boincmgr!wxEventLoopBase::Run(void)+0x10d [c:\src\sdks\wx302\src\common\evtloopcmn.cpp @ 78] 39 000000fb`92aff750 00007ff7`09772db1 boincmgr!wxAppConsoleBase::MainLoop(void)+0xa2 [c:\src\sdks\wx302\src\common\appbase.cpp @ 334] 3a 000000fb`92aff7c0 00007ff7`099eae05 boincmgr!wxAppConsoleBase::OnRun(void)+0x31 [c:\src\sdks\wx302\src\common\appbase.cpp @ 260] 3b 000000fb`92aff7f0 00007ff7`09881347 boincmgr!wxAppBase::OnRun(void)+0x45 [c:\src\sdks\wx302\src\common\appcmn.cpp @ 305] 3c 000000fb`92aff820 00007ff7`098399e0 boincmgr!wxEntryReal( int * argc = 0x00007ff7`0a590ef0, wchar_t ** argv = 0x00000204`78683e10)+0x167 [c:\src\sdks\wx302\src\common\init.cpp @ 495] 3d 000000fb`92aff8f0 00007ff7`099ea5aa boincmgr!wxEntry( int * argc = 0x00007ff7`0a590ef0, wchar_t ** argv = 0x00000204`78683e10)+0x40 [c:\src\sdks\wx302\src\msw\main.cpp @ 188] 3e 000000fb`92aff930 00007ff7`09766bb4 boincmgr!wxEntry( struct HINSTANCE__ * hInstance = 0x00007ff7`094a0000, struct HINSTANCE__ * __formal = 0x00000000`00000000, char * __formal = 0x00000000`00000000 "", int nCmdShow = 0n1)+0x9a [c:\src\sdks\wx302\src\msw\main.cpp @ 415] 3f 000000fb`92aff9a0 00007ff7`09770351 boincmgr!WinMain( struct HINSTANCE__ * hInstance = 0x00007ff7`094a0000, struct HINSTANCE__ * hPrevInstance = 0x00000000`00000000, char * __formal = 0x00000204`78613d58 "", int nCmdShow = 0n1)+0x44 [c:\dev\boinc\src\clientgui\boincguiapp.cpp @ 58] 40 000000fb`92aff9d0 00007ff7`097700ce boincmgr!__tmainCRTStartup(void)+0x271 [f:\dd\vctools\crt\crtw32\dllstuff\crtexe.c @ 618] 41 000000fb`92affa50 00007ffd`646d8364 boincmgr!WinMainCRTStartup(void)+0xe [f:\dd\vctools\crt\crtw32\dllstuff\crtexe.c @ 466] 42 000000fb`92affa80 00007ffd`669f70d1 KERNEL32!BaseThreadInitThunk+0x14 43 000000fb`92affab0 00000000`00000000 ntdll!RtlUserThreadStart+0x21 0:000> g (21b4.240c): Break instruction exception - code 80000003 (first chance) boincmgr!std::_Deque_const_iterator > >::operator*+0xce: 00007ff7`0972831e cc int 3 0:000> g (21b4.240c): Security check failure or stack buffer overrun - code c0000409 (!!! second chance !!!) MSVCR120D!_invoke_watson+0x2b: 00007ffd`3396cfeb cd29 int 29h 0:000> kP 6 # Child-SP RetAddr Call Site 00 000000fb`92af9e20 00007ffd`3396cfb3 MSVCR120D!_invoke_watson( wchar_t * pszExpression = 0x00007ff7`09f03de0 ""out of range"", wchar_t * pszFunction = 0x00007ff7`0a147590 "std::_Deque_const_iterator > >::operator *", wchar_t * pszFile = 0x00007ff7`0a0a9110 "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\deque", unsigned int nLine = 0x14b, unsigned int64 pReserved = 0)+0x2b [f:\dd\vctools\crt\crtw32\misc\invarg.c @ 132] 01 000000fb`92af9e50 00007ff7`0972834b MSVCR120D!_invalid_parameter( wchar_t * pszExpression = 0x00007ff7`09f03de0 ""out of range"", wchar_t * pszFunction = 0x00007ff7`0a147590 "std::_Deque_const_iterator > >::operator *", wchar_t * pszFile = 0x00007ff7`0a0a9110 "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\deque", unsigned int nLine = 0x14b, unsigned int64 pReserved = 0)+0x83 [f:\dd\vctools\crt\crtw32\misc\invarg.c @ 86] 02 000000fb`92af9ea0 00007ff7`09728428 boincmgr!std::_Deque_const_iterator > >::operator*(void)+0xfb [c:\program files (x86)\microsoft visual studio 12.0\vc\include\deque @ 342] 03 000000fb`92af9f00 00007ff7`0972b996 boincmgr!std::_Deque_iterator > >::operator*(void)+0x28 [c:\program files (x86)\microsoft visual studio 12.0\vc\include\deque @ 604] 04 000000fb`92af9f30 00007ff7`0971baf5 boincmgr!std::deque >::at( unsigned int64 _Pos = 0x1b)+0xa6 [c:\program files (x86)\microsoft visual studio 12.0\vc\include\deque @ 1381] 05 000000fb`92af9fc0 00007ff7`0962f734 boincmgr!CMainDocument::message( unsigned int i = 0x1b)+0x65 [c:\dev\boinc\src\clientgui\maindocument.cpp @ 2116] 0:000> g WARNING: Continuing a non-continuable exception (21b4.240c): Security check failure or stack buffer overrun - code c0000409 (!!! second chance !!!) MSVCR120D!_invoke_watson+0x2b: 00007ffd`3396cfeb cd29 int 29h Signed-off-by: Vitalii Koshura --- clientgui/MainDocument.cpp | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/clientgui/MainDocument.cpp b/clientgui/MainDocument.cpp index 66b23a4d6b..9e96736da1 100644 --- a/clientgui/MainDocument.cpp +++ b/clientgui/MainDocument.cpp @@ -2109,17 +2109,10 @@ done: MESSAGE* CMainDocument::message(unsigned int i) { - MESSAGE* pMessage = NULL; + if (messages.messages.empty() || messages.messages.size() <= i) + return NULL; - try { - if (!messages.messages.empty()) - pMessage = messages.messages.at(i); - } - catch (std::out_of_range e) { - pMessage = NULL; - } - - return pMessage; + return messages.messages.at(i); }