This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 167547 - 100% CPU core usage with C++ project
Summary: 100% CPU core usage with C++ project
Status: VERIFIED FIXED
Alias: None
Product: cnd
Classification: Unclassified
Component: -- Other -- (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker (vote)
Assignee: nnnnnk
URL:
Keywords: PERFORMANCE
Depends on:
Blocks:
 
Reported: 2009-06-23 16:45 UTC by simulacrum
Modified: 2009-07-17 13:57 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
call tree dump (2.75 MB, text/xml)
2009-06-23 16:50 UTC, simulacrum
Details
hotspot dump (199.86 KB, text/xml)
2009-06-23 16:50 UTC, simulacrum
Details
info dump (28.56 KB, application/octet-stream)
2009-06-23 16:53 UTC, simulacrum
Details
meta swtich file (5.55 KB, text/plain)
2009-06-23 23:23 UTC, simulacrum
Details
meta switch dependency - "if" (1.04 KB, text/plain)
2009-06-23 23:24 UTC, simulacrum
Details
meta switch dependency - "common" (2.09 KB, text/plain)
2009-06-23 23:25 UTC, simulacrum
Details
console output from command line during error state (27.99 KB, text/plain)
2009-06-23 23:37 UTC, simulacrum
Details
textual thread dump 1 (26.48 KB, text/plain)
2009-06-24 05:35 UTC, simulacrum
Details
textual thread dump 2 (24.66 KB, text/plain)
2009-06-24 05:35 UTC, simulacrum
Details
textual thread dump 3 (24.92 KB, text/plain)
2009-06-24 05:36 UTC, simulacrum
Details

Note You need to log in before you can comment on or make changes to this bug.
Description simulacrum 2009-06-23 16:45:41 UTC
This error is 100% reproducible with Netbeans 6.5-6.7.

Key Information:
q6600
4GB Ram
Fedora 11 x86_64
GCC 4.4
OpenJDK 6 OR sun java 6 update 14 OR sun java 5 update 18

I can provide a thread dump, as of yet cannot see how to create attachments.

When a C++ Project is loaded 100% CPU load is observed (all cores,100%utilization).  After the project is fully loaded
the CPU utilization falls.  The CPU utilization remains fixed at 1 CPU core at 100% utilization.  The CPU utilization
never stops.  It does not stop while the IDE is running.  After the IDE is shutdown the CPU utilization persists as
described above.

The only way to recover the CPU core is to log out of the user session entirely and log back in.

If this is not done the CPU core remains unusable.

This error is easily compounded by the following steps.

1. Open the IDE with the same C++ project as the main project OR the same project can be loaded manually.
2. Close the IDE
3  Repeat goto step 1

The result is one CPU core lost for each time the IDE is loaded.  If repeated a sufficient number of times the system
becomes completely unusable.  The system can only be recovered by powering off and powering back on.
Comment 1 simulacrum 2009-06-23 16:50:15 UTC
Created attachment 83948 [details]
call tree dump
Comment 2 simulacrum 2009-06-23 16:50:53 UTC
Created attachment 83949 [details]
hotspot dump
Comment 3 simulacrum 2009-06-23 16:53:00 UTC
Created attachment 83950 [details]
info dump
Comment 4 Vladimir Voskresensky 2009-06-23 22:35:25 UTC
could you, please, generate textual thread dump? 
(run nb from command line and press Ctrl+/ when you see the problem)
+ can you provide macro expanded view of the file  /usr/local/include/cml/core/meta/switch.h
(open file in editor and click on any identifier with Ctrl+Alt, then switch to "whole file" mode

Thanks,
Vladimir.
Comment 5 simulacrum 2009-06-23 23:21:10 UTC
I want to help.

I have run netbeans from the command line.  The entire IDE starts and immediately the error state presents itself so
long as my C++ project is loaded.

When I press Ctrl + / in the editor I get a comment - outside of the editor I don't see that anything happens.  I am
very new to NB.  You may have to provide me baby steps but I am very willing to follow them.

When I discover how to generate a textural thread dump I will upload it.
Comment 6 simulacrum 2009-06-23 23:23:28 UTC
Created attachment 83964 [details]
meta swtich file
Comment 7 simulacrum 2009-06-23 23:24:23 UTC
Created attachment 83965 [details]
meta switch dependency - "if"
Comment 8 simulacrum 2009-06-23 23:25:03 UTC
Created attachment 83966 [details]
meta switch dependency - "common"
Comment 9 simulacrum 2009-06-23 23:37:33 UTC
Created attachment 83967 [details]
console output from command line during error state
Comment 10 Vladimir Voskresensky 2009-06-24 05:14:03 UTC
to generate thread dump you should press Ctrl+\ in console (not in editor)
Comment 11 Vladimir Voskresensky 2009-06-24 05:17:14 UTC
Btw, is your project is http://cmldev.net/? Then we can investigate ourself
Comment 12 simulacrum 2009-06-24 05:28:38 UTC
Thank you for your patience.

I will upload a few textual thread dumps so that you have more data for you assessments.

Unfortunately, my project is not the cmldev.net project.  However, I will "try" to be as cooperative as possible.

I want to help.
Comment 13 simulacrum 2009-06-24 05:35:15 UTC
Created attachment 83972 [details]
textual thread dump 1
Comment 14 simulacrum 2009-06-24 05:35:41 UTC
Created attachment 83973 [details]
textual thread dump 2
Comment 15 simulacrum 2009-06-24 05:36:07 UTC
Created attachment 83974 [details]
textual thread dump 3
Comment 16 Alexander Simon 2009-06-24 06:18:09 UTC
It seems parser performance has exponential dependency from template nesting.
Parser should remove exponential dependency in own algorithm or give up parsing problem code.

Problem code is:
------------------------
template<typename Find
, typename T1,           typename R1
, typename T2 = NilCase, typename R2 = void
, typename T3 = NilCase, typename R3 = void
, typename T4 = NilCase, typename R4 = void
, typename T5 = NilCase, typename R5 = void
, typename T6 = NilCase, typename R6 = void
, typename T7 = NilCase, typename R7 = void
, typename T8 = NilCase, typename R8 = void
, typename T9 = NilCase, typename R9 = void
, typename T10 = NilCase, typename R10 = void
, typename T11 = NilCase, typename R11 = void
, typename T12 = NilCase, typename R12 = void
, typename T13 = NilCase, typename R13 = void
, typename T14 = NilCase, typename R14 = void
, typename T15 = NilCase, typename R15 = void
, typename T16 = NilCase, typename R16 = void
, typename T17 = NilCase, typename R17 = void
, typename T18 = NilCase, typename R18 = void
, typename T19 = NilCase, typename R19 = void
, typename T20 = NilCase, typename R20 = void
, typename T21 = NilCase, typename R21 = void
, typename T22 = NilCase, typename R22 = void
, typename T23 = NilCase, typename R23 = void
, typename T24 = NilCase, typename R24 = void
, typename T25 = NilCase, typename R25 = void
, typename T26 = NilCase, typename R26 = void
, typename T27 = NilCase, typename R27 = void
, typename T28 = NilCase, typename R28 = void
, typename T29 = NilCase, typename R29 = void
, typename T30 = NilCase, typename R30 = void
, typename T31 = NilCase, typename R31 = void
, typename T32 = NilCase, typename R32 = void
, typename T33 = NilCase, typename R33 = void
, typename T34 = NilCase, typename R34 = void
, typename T35 = NilCase, typename R35 = void
, typename T36 = NilCase, typename R36 = void
, typename T37 = NilCase, typename R37 = void
, typename T38 = NilCase, typename R38 = void
, typename T39 = NilCase, typename R39 = void
, typename T40 = NilCase, typename R40 = void
> struct select_switch
{
    typedef typename
          meta::select_case< T1,R1
        , meta::select_case< T2,R2
        , meta::select_case< T3,R3
        , meta::select_case< T4,R4
        , meta::select_case< T5,R5
        , meta::select_case< T6,R6
        , meta::select_case< T7,R7
        , meta::select_case< T8,R8
        , meta::select_case< T9,R9
        , meta::select_case< T10,R10
        , meta::select_case< T11,R11
        , meta::select_case< T12,R12
        , meta::select_case< T13,R13
        , meta::select_case< T14,R14
        , meta::select_case< T15,R15
        , meta::select_case< T16,R16
        , meta::select_case< T17,R17
        , meta::select_case< T18,R18
        , meta::select_case< T19,R19
        , meta::select_case< T20,R20
        , meta::select_case< T21,R21
        , meta::select_case< T22,R22
        , meta::select_case< T23,R23
        , meta::select_case< T24,R24
        , meta::select_case< T25,R25
        , meta::select_case< T26,R26
        , meta::select_case< T27,R27
        , meta::select_case< T28,R28
        , meta::select_case< T29,R29
        , meta::select_case< T30,R30
        , meta::select_case< T31,R31
        , meta::select_case< T32,R32
        , meta::select_case< T33,R33
        , meta::select_case< T34,R34
        , meta::select_case< T35,R35
        , meta::select_case< T36,R36
        , meta::select_case< T37,R37
        , meta::select_case< T38,R38
        , meta::select_case< T39,R39
        , meta::select_case< T40,R40
        , NilCase
        > > > > > > > > > >     /* 10 */
        > > > > > > > > > >     /* 10 */
        > > > >    /* 4 */
        > > > > > >     /* 6 */
        > > > > > > > > > >     /* 10 */
        ::template match<Find>::result result;
};
------------------------
The code has infinite parsing time (at least grate them 10 minutes).
Comment 17 Alexander Simon 2009-06-24 06:20:12 UTC
sorry typo: "grate them" -> "greater then"
Comment 18 nnnnnk 2009-06-29 14:27:46 UTC
fixed
http://hg.netbeans.org/cnd-main/rev/de9081b31e58
Comment 19 Quality Engineering 2009-06-30 05:44:46 UTC
Integrated into 'main-golden', will be available in build *200906300200* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/de9081b31e58
User: Nick N. Krasilnikov <nnnnnk@netbeans.org>
Log: fixed IZ#167547 : 100% CPU core usage with C++ project
Comment 20 simulacrum 2009-07-02 03:14:54 UTC
Thank you very much.  The situation has been resolved beautifully.
Comment 21 Vladimir Voskresensky 2009-07-02 06:57:50 UTC
verified by user.
The fix is safe and it should be included in patch1
Comment 22 pgebauer 2009-07-02 10:52:37 UTC
The fix has been ported into the release67_fixes repository.
http://hg.netbeans.org/release67_fixes/rev/48063021805a
Comment 23 Alexander Pepin 2009-07-16 17:06:07 UTC
verified in nb6.7.1rc build