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 253721 - CPU goes 100% without stopping after putting 1 tab before line
Summary: CPU goes 100% without stopping after putting 1 tab before line
Status: RESOLVED FIXED
Alias: None
Product: php
Classification: Unclassified
Component: Formatting & Indentation (show other bugs)
Version: 8.0
Hardware: PC Windows 7
: P2 normal (vote)
Assignee: Ondrej Brejla
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-07-24 09:13 UTC by dynasource
Modified: 2015-09-08 07:26 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
IDE log (53.19 KB, text/plain)
2015-07-24 09:13 UTC, dynasource
Details
Snapshot CPU 100% (696.83 KB, application/octet-stream)
2015-07-30 07:39 UTC, dynasource
Details

Note You need to log in before you can comment on or make changes to this bug.
Description dynasource 2015-07-24 09:13:31 UTC
Product Version = NetBeans IDE Dev (Build 201507180001)
Operating System = Windows 7 version 6.1 running on amd64
Java; VM; Vendor = 1.8.0_45
Runtime = Java HotSpot(TM) 64-Bit Server VM 25.45-b02

I have this file (see beneath).
After a tab before this line: $identity = Identity::find()->joinWith('password')->where('identity_password.id IS NULL')->one();
The javaw.exe goes nuts on processor which will never end. I cannot format the whole text anymore, unending lengthy process.

Things in the IDE log:
WARNING [org.netbeans.modules.progress.ui.RunOffEDTImpl]: Lengthy operation: org.netbeans.editor.ActionFactory$FormatAction$1:42,469:1:42,469:42469.00
INFO [org.netbeans.modules.git.status]: GitInterceptor.refreshTask: Scanning in progress, trying again in 10,000ms
INFO [org.netbeans.modules.git.status]: GitInterceptor.refreshTask: Scanning in progress, trying again in 10,000ms
INFO [org.netbeans.modules.git.status]: GitInterceptor.refreshTask: Scanning in progress, trying again in 10,000ms
INFO [org.netbeans.modules.git.status]: GitInterceptor.refreshTask: Scanning in progress, trying again in 10,000ms
WARNING [org.netbeans.core.TimableEventQueue]: too much time in AWT thread org.netbeans.modules.sampler.InternalSampler@138931b2
INFO [org.netbeans.modules.git.status]: GitInterceptor.refreshTask: Scanning in progress, trying again in 10,000ms
INFO [org.netbeans.modules.git.status]: GitInterceptor.refreshTask: Scanning in progress, trying again in 10,000ms
INFO [org.netbeans.modules.git.status]: GitInterceptor.refreshTask: Scanning in progress, trying again in 10,000ms
INFO [org.netbeans.modules.git.status]: GitInterceptor.refreshTask: Scanning in progress, trying again in 10,000ms
INFO [org.netbeans.modules.git.status]: GitInterceptor.refreshTask: Scanning in progress, trying again in 10,000ms

These formatting issues are really CRITICAL.






<?php

use dmn\yii2\tests\components\BaseCest;
use dmn\yii2\modules\identity\models\Identity;
use dmn\yii2\modules\identity\models\Password;

/*
 * @link http://www.dynasource.eu
 * @copyright (c) 2011 DMN
 * @license proprietary
 */

class PasswordCest extends BaseCest {

    public function reset($I) {
        $I->amOnPage(['identity/password/request-reset']);
        $I->click('#request-password-reset-form *[type=submit]');
        $I->see('Email cannot be blank');

        $I->fillField('//input[@name="PasswordResetRequestForm[email]"]', 'unknown@email.com');
        $I->click('#request-password-reset-form *[type=submit]');
        $I->see('Er is geen gebruiker met dit emailadres geregistreerd.');

        $I->fillField('//input[@name="PasswordResetRequestForm[email]"]', 'faulty_email.com');
        $I->click('#request-password-reset-form *[type=submit]');
        $I->see('Email is not a valid email address.');

        $password = Password::find()->with('identity')->where('reset_token=""')->one();
        $I->fillField('//input[@name="PasswordResetRequestForm[email]"]', $password->identity->email);
        $I->click('#request-password-reset-form *[type=submit]');
    }
    
    public function resetIfNoPassword($I)
    {
        $identity = Identity::find()->joinWith('password')->where('identity_password.id IS NULL')->one();
        $I->amOnPage(['identity/password/request-reset']);
        $I->fillField('//input[@name="PasswordResetRequestForm[email]"]', $identity->email);
        $I->click('#request-password-reset-form *[type=submit]');        
        $I->see('Bekijk je email voor verdere instructies');       
    }

}
Comment 1 dynasource 2015-07-24 09:13:37 UTC
Created attachment 154842 [details]
IDE log
Comment 2 Tomas Mysik 2015-07-28 13:36:28 UTC
Reassigning to formatter, please evaluate. Thanks.
Comment 3 Tomas Mysik 2015-07-30 07:29:26 UTC
I cannot reproduce your issue.

So, please, attach a profiler snapshot [1] for this issue; steps:
- start profiling
- reproduce your problem
- wait for about 30 seconds
- stop profiling

Reopen this issue and attach the snapshot here. Thanks.

Product Version: NetBeans IDE Dev (Build 20150730-0c51bc18fc08)
Java: 1.7.0_80; Java HotSpot(TM) 64-Bit Server VM 24.80-b11
Runtime: Java(TM) SE Runtime Environment 1.7.0_80-b15
System: Linux version 3.16.0-45-generic running on amd64; UTF-8; cs_CZ (nb)
Comment 4 Tomas Mysik 2015-07-30 07:30:33 UTC
Sorry, forgot to add link how to create profiler snapshot:

[1] http://wiki.netbeans.org/FitnessViaPartnership
Comment 5 dynasource 2015-07-30 07:39:38 UTC
Created attachment 155033 [details]
Snapshot CPU 100%
Comment 6 dynasource 2015-07-30 07:40:04 UTC
I attached the snapshot you asked for
Comment 7 Tomas Mysik 2015-07-30 07:41:37 UTC
Thus reopening, thanks.
Comment 8 Tomas Mysik 2015-09-07 10:12:17 UTC
From the snapshot, it seems that you have a deep class hierarchy - could you please attach your project? If not, could you please create a sample project with this same problem and attach it here? Likely taking PasswordCest class and _all_ its parent classes could be helpful.

Just to be sure - what are the exact steps to reproduce? Pressing TAB before line you mentioned? Or trying to format the whole file? I tried both with the sample file you provided but it works for me without any problem (but I don't have any parent classes, of course).

BTW, as for any other issue, trying a clean userdir [1] could help as well so please, give it a try and let us know.

Thanks.
[1] http://wiki.netbeans.org/FaqWhatIsUserdir

Product Version: NetBeans IDE Dev (Build 20150904-e2feafa1bb8a)
Java: 1.7.0_80; Java HotSpot(TM) 64-Bit Server VM 24.80-b11
Runtime: Java(TM) SE Runtime Environment 1.7.0_80-b15
System: Linux version 3.19.0-26-generic running on amd64; UTF-8; cs_CZ (nb)
Comment 9 dynasource 2015-09-07 10:51:05 UTC
to answer your questions:
* my project is my own framework. Unfortunately, I cannot supply it. (years of work)
* about PasswordCest, it extends from abstract class BaseCest{}, so it is not many levels deep.
* Identity indeed is extended from many subclasses
* the step is very simple: 1 tab before the line with $identity = Identity ...
* I am working on a RAM disk for all my temporary files. Every morning, my user dir is cleaned.

How should we further tackle this issue? Isnt my IDE log enough to see what the root cause is? Of course, Ill be happy to supply single files on your request
Comment 10 Tomas Mysik 2015-09-07 11:42:10 UTC
(In reply to dynasource from comment #9)
> * Identity indeed is extended from many subclasses

So, this class is likely the culprit. It would help us if you could create a sample project containing just class hierarchy of Identity class, if possible.

Thanks.
Comment 11 Tomas Mysik 2015-09-07 11:56:56 UTC
Asking for waiver for this issue, it is unfortunately definitely out-of-scope for NB 8.1 to be fixed. The fix will be non-trivial, if possible at all; class hierarchy is read from index for each class so with a deep class hierarchy, this could be slow (many index reads mean many disk touches and this is slow, especially on Windows NTFS filesystem which is sometimes very slow).

Thanks.
Comment 12 dynasource 2015-09-07 12:38:07 UTC
(In reply to Tomas Mysik from comment #11)
> Asking for waiver for this issue, it is unfortunately definitely
> out-of-scope for NB 8.1 to be fixed. The fix will be non-trivial, if
> possible at all; class hierarchy is read from index for each class so with a
> deep class hierarchy, this could be slow (many index reads mean many disk
> touches and this is slow, especially on Windows NTFS filesystem which is
> sometimes very slow).
> 
> Thanks.

well, my drives are in fact NTFS, but I have a 12 CPU threads 4.3 Ghz with 2 new SSD in stripe, using RAM disks form temporary files, so the machine or hardware should not be the bottleneck. Also virus and other background services are turned off.

Isnt there a loop somewhere?
Comment 13 Tomas Mysik 2015-09-07 12:47:21 UTC
(In reply to dynasource from comment #12)
> Isnt there a loop somewhere?

As I wrote, getting information about class hierarchy is a loop. But unfortunately cannot do much without a testing project.
Comment 14 dynasource 2015-09-07 13:05:54 UTC
I see. Well, I dived into it to get the files you need, but the issue seems resolved already within my current nightly 201508180002. I cannot reproduce the 100% CPU within the same file I posted earlier

I guess this issue can be closed.

thanx!
Comment 15 Tomas Mysik 2015-09-08 07:26:27 UTC
(In reply to dynasource from comment #14)
> I see. Well, I dived into it to get the files you need, but the issue seems
> resolved already within my current nightly 201508180002. I cannot reproduce
> the 100% CPU within the same file I posted earlier

Great to hear! My only idea was that some of your classes could have same names but different namespaces. But that was just a guess.

> I guess this issue can be closed.
> 
> thanx!

So, removing the waiver keyword. Thanks for your cooperation!