Author Topic: C::B crash after it wakes from hibernation  (Read 2548 times)

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5377
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
C::B crash after it wakes from hibernation
« on: December 05, 2020, 04:26:20 am »
Any one notice this crash issue?

I see such crash call stack:

Code
codeblocks.exe caused an Access Violation at location 0000000070A94BEC in module codeblocks.dll Reading from location 0000000000000000.

AddrPC           Params
0000000070A94BEC 0000000006ADB440 0000000000000001 0000000000000014  codeblocks.dll!SurfaceD2D::InitPixMap
0000000070B62F26 0000000006CB7640 000000001665C9F0 0000000006A5F6A0  codeblocks.dll!EditView::RefreshPixMaps
0000000070B46A6B 0000000006CB7090 000000001665C9F0 000000000022ED20  codeblocks.dll!Editor::RefreshPixMaps
0000000070B46C64 0000000006CB7090 000000001665C9F0 0000000006CB7090  codeblocks.dll!Editor::Paint
0000000070A9DD66 0000000006CB7090 000000000022EE50 0000000070A8DF6C  codeblocks.dll!ScintillaWX::DoPaint
0000000070A8DFE2 0000000006A5F6A0 000000000022F130 0000000000000000  codeblocks.dll!wxScintilla::OnPaint
0000000066A831B4 00000000009F0298 0000000077907B14 0000000000000003  wxmsw314u_gcc_cb.dll!wxAppConsoleBase::CallEventHandler
0000000066BDC1F2 000000000013076C 000007FEFAF7133C 000000000013076C  wxmsw314u_gcc_cb.dll!wxEvtHandler::ProcessEventIfMatchesId
0000000066BDC3B7 0000000006A5F6A0 000000000013076C 000000000022F088  wxmsw314u_gcc_cb.dll!wxEventHashTable::HandleEvent
0000000066BDCA0D 000000000000000F 000000000022F4C8 0000000000000018  wxmsw314u_gcc_cb.dll!wxEvtHandler::TryHereOnly
0000000066BDCA7D 0000000000000085 0000000000000000 0000000022042B33  wxmsw314u_gcc_cb.dll!wxEvtHandler::ProcessEventLocally
0000000066BDCB61 0000000000000000 0000000000000000 0000000000000000  wxmsw314u_gcc_cb.dll!wxEvtHandler::ProcessEvent
0000000066BDE81B 000000000022F180 0000000006A5F6A0 0000000006A5F6A0  wxmsw314u_gcc_cb.dll!wxEvtHandler::SafelyProcessEvent
0000000066CE7CD5 0000000000000085 0000000000000001 0000000000000000  wxmsw314u_gcc_cb.dll!wxWindow::HandlePaint
0000000066CE973F 000000000005023A 000000000000000F 0000000000000000  wxmsw314u_gcc_cb.dll!wxWindow::MSWHandleMessage
0000000066CD91CC 0000000000000000 000000000022FA10 0000000000000001  wxmsw314u_gcc_cb.dll!wxWindow::MSWWindowProc
00000000777F8855 0000000000000000 0000000066CE1060 0000000000000000  USER32.dll!GetWindowDC
00000000777F7197 000000000000000F 0000000066B95470 00000000003A4B40  USER32.dll!SetWindowTextW
00000000777F66D9 0000000000000000 000000006764EF29 00000000000C0DCC  USER32.dll!IsDialogMessageW
000000007794B5CF 00000000777F6D1C 0000000000000002 0000000000000000  ntdll.dll!KiUserCallbackDispatcher
00000000777F6D0A 0000000000000002 0000000000000000 0000000000000000  USER32.dll!BeginPaint
00000000777F6D1C 0000000000000000 0000000000000000 0000000066CE1060  USER32.dll!BeginPaint
00000000777F6672 0000000006A474E0 00000000777F7DF2 00000000FFFFFFEC  USER32.dll!IsDialogMessageW
0000000066CDBBAB 00000000068E2170 0000000066D2321B 00000000068E2190  wxmsw314u_gcc_cb.dll!wxWindow::MSWSafeIsDialogMessage
0000000066CDBDF9 0000000006A5F6A0 0000000000000001 00000000777F8F6A  wxmsw314u_gcc_cb.dll!wxWindow::MSWProcessMessage
0000000066D0999A 000000000000000F 0000000000000000 0000000000000000  wxmsw314u_gcc_cb.dll!wxGUIEventLoop::PreProcessMessage
0000000066D09861 00000000003A4B40 0000000066A853FF 0000000066CE1060  wxmsw314u_gcc_cb.dll!wxGUIEventLoop::ProcessMessage
0000000066D09676 00000000068E2170 000000000000000F 0000000000000000  wxmsw314u_gcc_cb.dll!wxGUIEventLoop::Dispatch
0000000066AB6523 00000000068E2170 000007FEFF9513D2 0000000000000002  wxmsw314u_gcc_cb.dll!wxEventLoopManual::ProcessEvents
0000000066AB660E 00000000003A4B40 00000000068E2170 0000000000000048  wxmsw314u_gcc_cb.dll!wxEventLoopManual::DoRun
0000000066AB6279 00000000068EA5A0 000000020000001C 00000000068E2170  wxmsw314u_gcc_cb.dll!wxEventLoopBase::Run
0000000066A8719A 000000000000001E 0000000000000009 000000000022FD30  wxmsw314u_gcc_cb.dll!wxAppConsoleBase::MainLoop
0000000000405808 00000000003A4B40 0000000066BE944B 000000000036ADA0  codeblocks.exe!0x5808
0000000066AFEB95 0000000000000048 0000000000000006 000000000036ADA0  wxmsw314u_gcc_cb.dll!wxInitialize
000000000040255B 0000000000400000 0000000000000000 00000000007535F2  codeblocks.exe!0x255b
00000000004013C7 0000000000000000 0000000000000000 0000000000000000  codeblocks.exe!0x13c7
00000000004014CB 0000000000000000 0000000000000000 0000000000000000  codeblocks.exe!0x14cb
00000000776D556D 0000000000000000 0000000000000000 0000000000000000  kernel32.dll!BaseThreadInitThunk
000000007793385D 0000000000000000 0000000000000000 0000000000000000  ntdll.dll!RtlUserThreadStart

It looks like after this crash, C::B try to connect some internet address IP(204.79.197.219, sounds like a MS cloud server IP), this is detected my network firewall (https://github.com/henrypp/simplewall)
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline Miguel Gimenez

  • Lives here!
  • ****
  • Posts: 795
Re: C::B crash after it wakes from hibernation
« Reply #1 on: December 05, 2020, 01:01:03 pm »
The connection is made by Windows itself trying to send a crash report.

Hibernation has caused a lot of problems on Windows, specially with flaky drivers. This may be a problem in C::B, but I think it is related to your graphic card driver not restoring the D2D surface properly.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5377
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: C::B crash after it wakes from hibernation
« Reply #2 on: December 05, 2020, 04:00:21 pm »
Thanks for the reply.

The connection is made by Windows itself trying to send a crash report.

Hibernation has caused a lot of problems on Windows, specially with flaky drivers. This may be a problem in C::B, but I think it is related to your graphic card driver not restoring the D2D surface properly.
I think you are right.
I never see it crashed if I don't enable the "Ligature feature" of the editor.
I think I have install the latest Intel HD graphics card's driver in my notebook.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5377
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: C::B crash after it wakes from hibernation
« Reply #3 on: December 06, 2020, 04:06:58 am »
I think it maybe a C::B bug, because I can reproduce this crash on two PCs, call-stacks show that all are related to direct2d calls.
But they have different graphics cards.

EDIT:

I found that not only hibernation will crash the crash, but just lock the screen and login will cause crash too.
« Last Edit: December 06, 2020, 06:16:38 am by ollydbg »
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7180
    • My Best Post
Re: C::B crash after it wakes from hibernation
« Reply #4 on: December 06, 2020, 08:59:11 am »
Do you have an project open when the problem happens?
Do you have an file open in the editor when the problem happens?

What windows version?

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5377
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: C::B crash after it wakes from hibernation
« Reply #5 on: December 06, 2020, 03:59:32 pm »
Do you have an project open when the problem happens?
Yes.


Quote
Do you have an file open in the editor when the problem happens?
Yes.

Quote
What windows version?
Win7, 64bit.

If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7180
    • My Best Post
Re: C::B crash after it wakes from hibernation
« Reply #6 on: December 06, 2020, 09:28:27 pm »
Did not see the problem when locking and unlocking.

Edit: With small one file project open and with the file open.

CB Nightly under Windows 7 64 bit
Code
Name             : Code::Blocks
Version          : svn-r12233
SDK Version      : 2.4.0
Scintilla Version: 3.7.5
Author           : The Code::Blocks Team
E-mail           : [email protected]
Website          : http://www.codeblocks.org

wxWidgets Library (wxMSW port)
Version 3.1.3 (Unicode: wchar_t, debug level: 1),
compiled at Jun  7 2020 10:54:43

Runtime version of toolkit used is 6.1.
« Last Edit: December 06, 2020, 09:35:13 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5377
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: C::B crash after it wakes from hibernation
« Reply #7 on: December 08, 2020, 03:01:35 am »
Did not see the problem when locking and unlocking.
Hi, Tim, thanks for the test.
I did test several times, and it looks like locking and unlocking does not cause crashes.
While hibernation or remote desktop login cause crashes.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13438
    • Travis build status
Re: C::B crash after it wakes from hibernation
« Reply #8 on: December 08, 2020, 10:34:45 am »
I think remote desktop causing crashes is a known thing. I think we have a ticket about it.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Miguel Gimenez

  • Lives here!
  • ****
  • Posts: 795
Re: C::B crash after it wakes from hibernation
« Reply #9 on: December 08, 2020, 10:41:45 am »
Remote desktop causes unresponsive editor when you switch to local desktop leaving C::B visible and then come back, but not a crash. I have never left C::B open when closing the session, though.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13438
    • Travis build status
Re: C::B crash after it wakes from hibernation
« Reply #10 on: December 08, 2020, 12:54:33 pm »
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]