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 248570 - Slow scanning CDI seems to cause very slow completion
Summary: Slow scanning CDI seems to cause very slow completion
Status: RESOLVED FIXED
Alias: None
Product: javaee
Classification: Unclassified
Component: CDI (show other bugs)
Version: 8.0.1
Hardware: PC Windows 7
: P2 normal with 1 vote (vote)
Assignee: Sergey Petrov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-11-11 12:53 UTC by iluvtr
Modified: 2014-11-30 04:39 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
NB log (556.64 KB, application/octet-stream)
2014-11-11 12:53 UTC, iluvtr
Details
NB Log 2 (153.25 KB, application/octet-stream)
2014-11-11 12:56 UTC, iluvtr
Details
Self sampler (1.49 MB, application/octet-stream)
2014-11-11 18:09 UTC, iluvtr
Details
NB Log Part 1 (831.85 KB, application/octet-stream)
2014-11-12 22:07 UTC, iluvtr
Details
NB Log Part 2 (1.00 MB, application/octet-stream)
2014-11-12 22:08 UTC, iluvtr
Details
New Self sampler (3.35 MB, application/octet-stream)
2014-11-12 22:11 UTC, iluvtr
Details
Project sample (8.07 MB, application/zip)
2014-11-26 13:13 UTC, iluvtr
Details

Note You need to log in before you can comment on or make changes to this bug.
Description iluvtr 2014-11-11 12:53:41 UTC
Created attachment 150426 [details]
NB log

I have a project with a JAX-RS resoource with a couple of CDI injections, the problem in this class is that the completion takes a very long time (Up to 30 seconds after Ctrl Space bar)
Comment 1 iluvtr 2014-11-11 12:56:11 UTC
Created attachment 150427 [details]
NB Log 2
Comment 2 Sergey Petrov 2014-11-11 16:42:32 UTC
nps snapshot if slowdown is detected can be submitted automatically, it's nice to have this snapshot. also sample code should matter.
I know at least one use case when cdi completion is really slow, if you are injection some 'Object' type as cdi is trying to collect all possible objects.
Comment 3 iluvtr 2014-11-11 18:09:08 UTC
Created attachment 150439 [details]
Self sampler
Comment 4 iluvtr 2014-11-12 22:07:01 UTC
Created attachment 150459 [details]
NB Log Part 1
Comment 5 iluvtr 2014-11-12 22:08:08 UTC
Created attachment 150460 [details]
NB Log Part 2
Comment 6 iluvtr 2014-11-12 22:11:29 UTC
Created attachment 150461 [details]
New Self sampler
Comment 7 iluvtr 2014-11-12 22:11:48 UTC
Please check the self samplers and logs
Comment 8 Sergey Petrov 2014-11-14 15:13:59 UTC
log is filled with hundreds of 
WARNING [org.netbeans.modules.web.beans.model.spi.WebBeansModelProvider]: ClassIndex.getElements() was interrupted

but it may not matter.
Does you class contain injection for beans from archives? Are these archives explicit bean archives?
I suppose I can see a problem as in this case cdi tries to verify existence of file here and presence of beans xml and it cause a lot of io operation, but I'm not sure so far why it was implemented this way. 

At least one suspected reason is 130 .getFile calls for 150 seconds, even if it's in separate thread I can expect system slowdown as there are thousands of sun.nio.fs object calls. But it's hard to evaluate if all calls are necessary without a sample(project), and hard to estimate when it can be fixed, this area have been working this way for several years. On the other hand 130 calls may not be too many, and it maybe windows filesystem slowness also.
Comment 9 iluvtr 2014-11-26 13:13:01 UTC
Created attachment 150725 [details]
Project sample

This project is good example showing the bug, Check the class pe.dmsolutions.dmregalos.login.LoginAdministracionResource, try to autocomplete in the fields area, try to rename a method inside this class, here try to rename the class SeguridadDao to SeguridadDao2, try to inject the class SomeServiceWar, 
Everything takes horrible longer
Comment 10 iluvtr 2014-11-26 13:19:34 UTC
In order to reproduce the bug you should do a few completions first (The first completions are acceptable, the problem comes then)
Comment 11 iluvtr 2014-11-27 12:32:53 UTC
Please check the project I sent you
Comment 12 Sergey Petrov 2014-11-27 12:44:14 UTC
I hope to try tomorrow, feel free to remind if there will be no updates
Comment 13 Sergey Petrov 2014-11-28 16:43:26 UTC
ok, it's still an issue to find out if it's really necessary to check a lot of files and so to have a lot of io,
but I've found cdi analytics/hints etc wasn't canceled properly on deep level when 'cancel' is requested, i.e. loop to check files had nothing like (if cancel then break) and all files were accessed each time, 
with 2f0ada68e3ac cancel status is propagated now and it work faster to cc for me, 
another issue it's too long to get cdi hints but these do not block cc as I see.

please try dev build if possible after integration message and reopen if you'll see no improvements.
Comment 14 Sergey Petrov 2014-11-28 16:44:56 UTC
one more, point, if it works for you, current fix may be patch candidate for next patch if we have any
Comment 15 Quality Engineering 2014-11-30 04:39:21 UTC
Integrated into 'main-silver', will be available in build *201411300001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/2f0ada68e3ac
User: Sergey B. Petrov <sj-nb@netbeans.org>
Log: #248570 propagate cancel status as much as possible