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 251038 - background scanning of projects hangs at 67%
Summary: background scanning of projects hangs at 67%
Status: RESOLVED DUPLICATE of bug 250985
Alias: None
Product: javascript
Classification: Unclassified
Component: Editor (show other bugs)
Version: 8.0.2
Hardware: PC Linux
: P3 normal (vote)
Assignee: Petr Pisl
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-03-09 15:49 UTC by headbank
Modified: 2015-03-11 14:08 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
IDE message log (FINE debug enabled) (215.34 KB, text/x-log)
2015-03-09 15:49 UTC, headbank
Details
Updater log snippet (190.00 KB, text/x-log)
2015-03-09 15:51 UTC, headbank
Details
Profiler snapshot (1.24 MB, application/octet-stream)
2015-03-10 02:59 UTC, headbank
Details

Note You need to log in before you can comment on or make changes to this bug.
Description headbank 2015-03-09 15:49:15 UTC
Created attachment 152504 [details]
IDE message log (FINE debug enabled)

Netbeans-8.0.2 release distro (not from package-manager) installed to my homedir, Oracle JDK-1.8.0_31 on amd64 Gentoo Linux.

After updating some plugins, "Background scanning of projects..." task hangs at 67% and has to be killed even after closing the IDE, with

pkill -HUP -f nbexec

This happens consistently, on every run.  I've closed all projects which prevents the task running, but as soon as I open my project (PHP, using SVN) it starts and hangs predictably.

From the log it appears the Subversion module might be the issue, and indeed this was among the modules updated two days ago (updater log to follow).  I've also disabled all unused PHP modules, to no effect.

Debug-enabled message log attached.
Comment 1 headbank 2015-03-09 15:51:50 UTC
Created attachment 152505 [details]
Updater log snippet

Updater log snippet showing all modules updated before issue began (7 Mar) and disabled since.
Comment 2 Vladimir Riha 2015-03-09 20:40:41 UTC
Could you please take a profiling snapshot? (see [1]). Simply start profiling, open the problematic project that causes scanning hang and let it scan for some time (e.g. a minute), stop profiling and attach the snapshot here?

Thank you in advance.


[1] http://wiki.netbeans.org/FaqProfileMeNow
Comment 3 headbank 2015-03-10 02:59:05 UTC
Created attachment 152515 [details]
Profiler snapshot
Comment 4 Vladimir Riha 2015-03-10 07:26:00 UTC
Thank you, it seems that most of the time is spent in JavaScript editor, reassigning.

Would it be possible to share the project?
Comment 5 headbank 2015-03-10 12:33:04 UTC
Sorry, the project contents are privileged, so I can't share it in its entirety. But I'll answer anything I'm able to, and can possibly provide _some_ files.

I have done a little further testing with some other projects, starting with no projects open and opening each in turn (none have files that open in the editor when the project opens).

About a third of them cause a hang on opening.  They're all PHP projects, the only general observations about the set affected are that they're probably the largest projects and thus contain the most JS. They're also the most recently worked on, although almost all my projects were open in the IDE initially (albeit without any files open in the editor).

Other observations:

1. If a project doesn't have any files set to open in the editor when it (the project) opens, then indexing hangs at 100%, not 67%.

2. In most cases, just after project opening when indexing starts to thrash, closing the project can rescue it (the indexing task either bails or completes, not sure which).  I think there must be a "point of no return" for this.

3. I tried opening some files I was working on when the problem appeared _without_ opening the project itself.  3 pure JS files, the largest ~500LOC, a pure PHP file ~100LOC, and one small PHP+HTML+JS file.  This in itself was fine, no issues. However, when I then tried to open the project, the Opening Project task hung at 10% (so it never got as far as indexing).  Tried to close the project as quickly as possible, but it was hung just as badly as before (needing killed from the shell after closing the IDE).

4. I opened the same profile on another, similar-spec machine that hasn't had the weekend's updates, and there were no issues at all.
Comment 6 Vladimir Riha 2015-03-10 12:57:57 UTC
I think that opening file without having opened the project somehow limits code completion and other features and so that's the reason why it works.

It is difficult to narrow the problem without having the code to reproduce. Could you please try to find the culprit file and maybe sent it via email? 

There are 2 more things you could try:
 - start NetBeans without the problematic project, go to Tools|Options|Editor|Hints, select JavaScript language and disable the "global variable is not declared", confirm changes and open the project
 - 2nd thing (ideally worth trying with ENABLED "global variable is not declared" hint), you could try to install [1]: download the NBM file, in NetBeans, go to Tools|Plugins|Downloaded -> Add Plugins, select the download file and the press Install to install it.

The #1 is a workaround that hides the problem by disabling hint but unfortunately won't resolve the issue. The #2 is a fix for issue 250985 and it should be available as patch as soon as possible.

Thank you


[1] https://netbeans.org/bugzilla/attachment.cgi?id=152528
Comment 7 Petr Pisl 2015-03-10 12:59:52 UTC
Hi, thanks for your help. 

The progress for scanning reflects number of index root that has to be scanned. Some index root can be small, another one can include many files and it can take more time to index it. 

It can be caused by the issue #250985. Please try the nbm as Vlade advice. Thanks
Comment 8 headbank 2015-03-10 13:43:40 UTC
Neither of the suggestions (disabling hint or installing the NBM) made any difference.  It seems as though the chance of preventing the hang by closing the project has improved slightly, but that's anecdotal.

I did find that having files from the bad project open (without the project itself being open) would even trigger the hang when I opened an *unaffected* project (i.e. one that I could open, and open files from, in isolation with no issues).  Closing the files would not stop the hang, but closing the other project would.

I might be able to share some possible suspect files since they are currently still work-in-progress.  I'll ask about this tomorrow.
Comment 9 jzu 2015-03-11 10:13:19 UTC
Hi,

maybe I can help out with a reproduceable scenario:

With this I was able to reproduce the hanging background scan on three different machines (all with 8.0.2 and the latest updates) and on one it was not hanging (8.0.2 but omitted the last updates, Netbeans offers 14 updates).

- download current Joomla 3.4 Full Package https://github.com/joomla/joomla-cms/releases/download/3.4.0/Joomla_3.4.0-Stable-Full_Package.zip
- extract the zip archive to somewhere (I've used C:\Develop\test\Joomla_3.4.0)
- create new project in Netbeans (PHP Application with Existing Sources)
- choose the Joomla dir as Source Folder
- leave everything else as default (e.g. PHP 5.4, UTF-8, Run as Local Web Site...)
- Finish

now, Netbeans opens this new project and the Background scanning runs forever.

Hope this helps, we're having some Joomla projects and the latest Netbeans version is not usable with these projects.
Comment 10 jzu 2015-03-11 10:25:09 UTC
Ah, sorry, if it matters:

All machines running Windows 7/8 64bit, the JDK is 1.7.0 with different patch levels (21, 45 and 67)

The one machine where it's not hanging is Windows 7 with JDK 1.7.0_21
Comment 11 Petr Pisl 2015-03-11 10:37:59 UTC
@jzu: Thanks you very much. Could you try to Help -> Check for Updates and if there will be an update available, could you apply it. If not could you manually install the nbm from here https://netbeans.org/bugzilla/attachment.cgi?id=152528


Then try to open Joomla project again and let us know, whether the problem is still there. Thank you.
Comment 12 jzu 2015-03-11 11:24:04 UTC
Wow, EEhhhYes!

That solved my problem. I've updated the JavaScript2 Editor with Help -> Check for Updates and now the scanning works and finishes.

I've tested with the vanilla Joomla 3.4 as well as with some of our running Joomla projects.

Thanks a lot!
Comment 13 headbank 2015-03-11 11:55:34 UTC
Petr, I just emailed you an offending JS file. Hope it helps.
Comment 14 Petr Pisl 2015-03-11 12:03:01 UTC
@headbank: Could you send me the file on email petr.pisl@oracle.com. Unfortunately I have n't received your e-mail yet. Thanks  a lot.
Comment 15 Petr Pisl 2015-03-11 12:22:32 UTC
@headbank: I'm sorry, I got it now. Thanks
Comment 16 Petr Pisl 2015-03-11 12:28:51 UTC
@headbank: I have tested your file. The file contains a js doc at the end of file, which was exactly the problem fixed by the new nbm. Did you apply the nbm with the fix as Vlada wrote in comment #6. 

Could you attached your message.log file here? Thanks.
Comment 17 headbank 2015-03-11 13:44:51 UTC
@Petr, I must apologise - I must have dropped the ball when I was testing the efficacy of the patch.  Today it actually does seem to work.

I mentioned that the hang had seemingly become more recoverable after applying; in fact after that there was no hang (not one requiring process-killing after closing NB, anyway).  From watching the indexing log it's become apparent that the indexer is just going very slowly due to maxed-out resources.

Other projects that were taking a heck of a long time to index involved CMSes (Drupal, Joomla) and silly me didn't strip out the cache dirs from the source trees so there was a *lot* of (redundant) JS and CSS to chew through.

So probably the only real issue here is I need more RAM :(

OTOH, these source-trees hadn't really changed significantly, so it does seem as though the indexer's resource requirements have risen. Is that likely?
Comment 18 Petr Pisl 2015-03-11 14:08:24 UTC
@headbank: The whole patch for 8.0.2 increased the version of indexer, because additional information are stored to the index (place where NetBeans keeps data like name of identifiers from various files etc). So we need to reindex all the sources, even if there was not changed. And this can be done via increasing index version.

I'm closing this issue as duplicate of issue #250985.

Thanks.

*** This bug has been marked as a duplicate of bug 250985 ***