Author Topic: CB Freezes after opening file  (Read 6502 times)

Offline BjoernP

  • Multiple posting newcomer
  • *
  • Posts: 11
CB Freezes after opening file
« on: February 14, 2007, 12:29:36 am »
Hi,
My CB freezes for >4s on each file opened. It only happens on my Notebook which is a Core2-Duo (!?!), not on the PC-Workstations I work on (all single-cores).

Opening a project with a dozen open files or so this can take up to ~20s. The files are loaded into their editor tabs in a rush, then CB will be stalled for a while.

Time-period of the freeze is not linear to the number of files, curve is decreases when more files are loaded in a batch.
There seems to be some relation to the number and depth of includes in the files (not all sure on that).

For a screenshot see the attached file. What is it doing there?  :shock:

I get the same picture on my rather old Athlon XP1600 PC when opening a project with a bunch of open files but that goes away after 1-2s and CB is responsive again.

As you can see from the details above I have a vague idea it might be a problem with threading on dual-core (something like th<Thread>::Join() waiting til time-out cause th runs on the sister-core...? very vague, ya...)

  • Can anybody confirm this?
  • Any clue where it's hanging?
  • Advice, how to find out?

Thx,
Bjoern


[attachment deleted by admin]
gcc-4.3-tdm (mingw), gcc-4.2.1-dw2 (mingw) << CB wx 2.8 (cvs WX_2_8_BRANCH)  << CB wx-2.9.x (cvs head) WinXP

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7785
    • My Best Post
Re: CB Freezes after opening file
« Reply #1 on: February 14, 2007, 12:44:54 am »
Please turn off all of your plugins other than the compiler plugin and then turn them on one at a time to see if a single plugin causes the issue.

Note, code completion is a likely cause of the problem you are talking about.

Tim S
C Programmer working to learn more about C++ and Git.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline TDragon

  • Lives here!
  • ****
  • Posts: 943
    • TDM-GCC
Re: CB Freezes after opening file
« Reply #2 on: February 14, 2007, 12:48:02 am »
Note, code completion is a likely cause of the problem you are talking about.
That was going to be my guess -- particularly as there have been issues with buggy multi-threading code in the code completion plugin in the past.
https://jmeubank.github.io/tdm-gcc/ - TDM-GCC compiler suite for Windows (GCC 9.2.0 2020-03-08, 32/64-bit, no extra DLLs)

Offline BjoernP

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: CB Freezes after opening file
« Reply #3 on: February 14, 2007, 01:06:53 am »
Thanks a lot for your quick reply.  :D
I will dig into this further as you adviced tomorrow and post my results.
For now I must get some sleep.

[update]
Couldn't resist trying this out but unfortunately: same results with all plugins disabled except Compiler-Plugin.

Could the profiler (gprof) tell me more about where the precious cycles are wasted?

BTW: In freeze CB eats ~50% cpu-cycles, meaning one core is completely occupied doing whatever.
« Last Edit: February 14, 2007, 01:25:45 am by BjoernP »
gcc-4.3-tdm (mingw), gcc-4.2.1-dw2 (mingw) << CB wx 2.8 (cvs WX_2_8_BRANCH)  << CB wx-2.9.x (cvs head) WinXP

Offline BjoernP

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: CB Freezes after opening file
« Reply #4 on: February 15, 2007, 02:10:24 am »
All right now, just digged through this and feeling quite a little confused...  :roll:

First: As you two supposed it seems to be drowning in the Codecompletion ParserThreads. How come I also saw the same effect yesterday with all plugins disabled, I don't know.

I have saved a couple of backtraces here, will analyze these and gather some more maybe tomorrow.

No idea how this is supposed to work though and it's a difficult to dig through this kind of stuff on your own...

Well, all starts with Parser::BatchParse().
After the first few seconds (~10s on ~30 open files in the project) I could catch up on Parser::Clear, called from its destructor which was called by a wxTimerEvent in CodeCompletion::OnFunctionsParsingTimer().
Following is Parser::HandleIncludes() but there i stopped for now (got a break on OnParseFile() with 120 files includes on the line -- BTW: disabling breakpoints during gdb-session is broken (again?)).

My questions:
Why is the Parser destroyed from a Timer-Event? Is this supposed to be a watchdog or kind of?
Why then does it come back only after 10-15s? Why a timer, why not a recursion limit? What does it take this that long to parse little more than 100 files anyway?
I might have another look at Parser::m_batchtimer. That is kind of a watchdog, worker-threads are supposed to be done when it times out (OnBatchTimer). Hmmm...
One more idea on dual-core strangeness: In Parse() (+498) wxThread::IsMain() is queried, setting m_IsBatch, starting the batch (m_Pool.BatchBegin();). I see, it's supposed to be the first one called, getting the whole gang started (but... shouldn't be better set out more explicitely, no? m_IsBatch is set from the beginning, why then reset it here?).
Now, what if wxThread::IsMain() will return true on each of my cores? Batch would get started twice... Just another idea, look into this more closely later... still, the time parsing takes is about 10 times what might be reasonable.

The above may sound like ranting on the code, but I am aware it's 99% my bad understanding. I really do not mean to offend anybody.  :)

For now, thanks reading.



gcc-4.3-tdm (mingw), gcc-4.2.1-dw2 (mingw) << CB wx 2.8 (cvs WX_2_8_BRANCH)  << CB wx-2.9.x (cvs head) WinXP

Offline BjoernP

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: CB Freezes after opening file
« Reply #5 on: February 18, 2007, 01:52:51 am »
I'm not sure how but the freezes are gone - for now.  :D
Could be mandrav's fix from tuesday but not sure.

Revision: 3601
Author: mandrav
Date: 13:59:12, Dienstag, 13. Februar 2007
Message:
- Fixed hang/crash on exit which "moved" to the windows platform.
----
Modified : /trunk/src/plugins/codecompletion/classbrowser.cpp


Thanks anyway!
gcc-4.3-tdm (mingw), gcc-4.2.1-dw2 (mingw) << CB wx 2.8 (cvs WX_2_8_BRANCH)  << CB wx-2.9.x (cvs head) WinXP

Offline BjoernP

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: CB Freezes after opening file
« Reply #6 on: February 24, 2007, 01:36:57 am »
Bad news: It's not fixed, was just mysteriously gone for a while. After a reboot everything behaves like before.  :?
I'm out of ideas for now.
gcc-4.3-tdm (mingw), gcc-4.2.1-dw2 (mingw) << CB wx 2.8 (cvs WX_2_8_BRANCH)  << CB wx-2.9.x (cvs head) WinXP