Bug 196985

Summary: The indexing infrastructure suddenly stoppeds to call PHPIndexer
Product: editor Reporter: Petr Pisl <ppisl>
Component: Parsing & IndexingAssignee: Tomas Zezula <tzezula>
Status: VERIFIED FIXED QA Contact: issues <issues.netbeans.org>
Priority: P1 CC: mmirilovic, pjiricka, tzezula
Version: 7.0Keywords: 70_HR_FIX
Target Milestone: 7.0   
Hardware: PC   
OS: Linux   
Whiteboard:
Issue Type: DEFECT Exception Report:

Description Petr Pisl 2011-03-22 20:49:26 UTC
Last week or two I have noticed that the PHPIndexer sometimes is not called. It works correctly after ide start, but after a while for a project the indexer is not called anymore. The indexer is not called after a change in editor and even after the save of the edited file. Only restart the ide helps to fix the situation.

From the user point of view it means that the changes are not stored in the index and are not propagated to the code completion. To reproduce - it's enough to have a php project with at least two files. In one file create a class with a methods and in the second file (not in the same file) try to use an instance of the class and call code completion for method and properties of the class.

When the php indexing stop work, the code completion in the second file doesn't display new methods and properties that was created recently in the first file. 

So have a first file like:

<?php

class Cls1 {
	
	static public function getInstance() {
		return new Cls1();
	}
	
	public function getName(){
		return new Cls1();
	}
        
        function bafbaf($param) {
            return self::getInstance();     
        }
        
        
        function dada($param) {
            return new TCPDF();
        }
       
	
}


class Cls2 {

	public function doSomething() {
		return Cls1::getInstance();
	}
        
        function hhhhh($param) {
            
        }

}

and second file:


<?php

class Usage {

    function example() {
        $cls2 = new Cls2();
        $cls1 = new Cls1();

        Cls1::getInstance()->getName()->getName();
        $cls1->getName()->getInstance();

        $cls2->doSomething()->getInstance();
    }

}

?>

Add a method in the class Cls1 or Cls2 and save the first file. Try invoke cc in class Usage for instance Cls1 or Cls2 in the second file, when you don't see the last added method, then the index infrastructure stopped called the php indexer.
Comment 1 Petr Pisl 2011-03-23 16:57:46 UTC
No it looks like that sometimes after the start of the ide and when scanning is finished, then the source roots of the php projects are removed from indexing infrastructure. To reproduce it, you have to have at least 2 php projects open, start the ide. The issues has the symptoms as I described in the description. The php files are not indexed -> new things are not propagated to the index -> code completion in other files is obsolete.
Comment 2 Petr Pisl 2011-03-24 14:40:58 UTC
I have tested a simple patch of Repository updater proposed by Tomas Zezula. After applying the change in RepositoryUpdater

@@ -1230,6 +1230,8 @@
             if (deps != null && deps != EMPTY_DEPS) {
                 ctx.oldRoots.remove(rootURL);
                 return true;
+            } else if (deps == EMPTY_DEPS) {
+                ctx.oldRoots.remove(rootURL);
             }
         }
         if (ctx.newRoots2Deps.containsKey(rootURL)) {

I was not able to reproduce anymore. The question is whether the patch can not influence something more.
Comment 3 Tomas Zezula 2011-03-24 14:49:57 UTC
But I am not very confident with the patch.
Comment 4 Tomas Zezula 2011-03-24 14:50:16 UTC
Anyway feel free to reassign to me.
Comment 5 Tomas Zezula 2011-03-24 15:07:13 UTC
The patch breaks testIndexManagerRefreshIndexListensOnChanges. So it cannot be applied.
Comment 6 Petr Pisl 2011-03-24 15:43:30 UTC
After discussion with Tomas, I reassigning this bug to him.
Comment 7 Tomas Zezula 2011-03-24 16:08:10 UTC
Fixed jet-main ce84e343c2b9
Comment 8 Tomas Zezula 2011-03-24 16:09:16 UTC
Can QA verify the fix?
It's also important to test if the fix did not affect java indexing.
Thanks
Comment 9 Jan Lahoda 2011-03-24 19:09:41 UTC
Seems fine to me.
Comment 10 Tomas Zezula 2011-03-24 20:39:31 UTC
Transplanted into 7.0 http://hg.netbeans.org/releases/rev/f9db9a951f06
Comment 11 maghiel 2011-03-25 02:42:45 UTC
Verified fixed on:
Product Version: NetBeans IDE Dev (Build nbms-and-javadoc-6919-on-20110324)
Java: 1.6.0_23; Java HotSpot(TM) Client VM 19.0-b09
System: Windows 7 version 6.1 running on x86; Cp1252; nl_NL (nb)
Comment 12 Tomas Zezula 2011-03-25 06:56:21 UTC
Thanks for verification
Comment 13 Quality Engineering 2011-03-28 08:49:16 UTC
Integrated into 'main-golden', will be available in build *201103280400* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/ce84e343c2b9
User: Tomas Zezula <tzezula@netbeans.org>
Log: #196985:The indexing infrastructure suddenly stoppeds to call PHPIndexer
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo