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 241992 - Binary dependency download in synchronous in OpenedProjectHook
Summary: Binary dependency download in synchronous in OpenedProjectHook
Status: RESOLVED WONTFIX
Alias: None
Product: projects
Classification: Unclassified
Component: Maven (show other bugs)
Version: 7.3
Hardware: All All
: P3 normal (vote)
Assignee: Tomas Stupka
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-02-17 09:55 UTC by rherschke
Modified: 2016-07-07 08:37 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter: 207680


Attachments
stacktrace (1.82 KB, text/plain)
2014-02-17 09:55 UTC, rherschke
Details

Note You need to log in before you can comment on or make changes to this bug.
Description rherschke 2014-02-17 09:55:44 UTC
This bug was originally marked as duplicate of bug 197261, that is already resolved. This bug is still valid, so this seems to be another bug, but it might be related.

Build: NetBeans IDE 7.3.1 (Build 201306052037)
VM: Java HotSpot(TM) 64-Bit Server VM, 24.45-b08, Java(TM) SE Runtime Environment, 1.7.0_45-b18
OS: Mac OS X

User Comments:
rherschke: When opening Netbeans, it tries to download maven dependencies. This is a long running process and all other processes (Opening Projects, Background Scanning of Projects) are blocked during the execution of this process.

This means, that Starting Netbeans with around 35 opened projects last at least 2 Minutes.

When trying to cancel the "download maven dependencies", nothing happens, the process is still running and still uses around 90% of CPU-Usage.

I'm using the STANDARD memory-settings in netbeans.conf.




Stacktrace: 
java.lang.ThreadDeath
   at org.netbeans.modules.maven.embedder.exec.ProgressTransferListener.checkCancel(ProgressTransferListener.java:113)
   at org.netbeans.modules.maven.embedder.exec.ProgressTransferListener.transferProgressed(ProgressTransferListener.java:189)
   at org.sonatype.aether.connector.wagon.WagonTransferListenerAdapter.transferProgress(WagonTransferListenerAdapter.java:69)
   at org.apache.maven.wagon.events.TransferEventSupport.fireTransferProgress(TransferEventSupport.java:121)
   at org.apache.maven.wagon.AbstractWagon.fireTransferProgress(AbstractWagon.java:515)
   at org.apache.maven.wagon.AbstractWagon.transfer(AbstractWagon.java:500)
Comment 1 rherschke 2014-02-17 09:55:46 UTC
Created attachment 145293 [details]
stacktrace
Comment 2 Milos Kleint 2014-02-17 12:59:07 UTC
please see explanation in issue 225736

not a netbeans problem primarily, very little we can do here with possible exception of issue 197624
Comment 3 rherschke 2014-02-17 13:04:50 UTC
Sure you CAN do something here.

The reasonable problem isn't the maven thread executor nor is it the ThreadDeath-Exception, but the dependency of the processes at startup.

The ThreadDeath-Exception is just a follow up. The main cause of this bug report is the poor and slowly start of netbeans with some count of projects, due to the "Download Maven Dependency" blocks the execution of all the other threads at startup.

So please change the dependencies and do not assume a fast internet connection for "download maven dependencies".

The same is true for "download javadoc" or "download sources"!
Comment 4 Milos Kleint 2014-02-17 13:15:05 UTC
(In reply to rherschke from comment #3)
> Sure you CAN do something here.
> 
> The reasonable problem isn't the maven thread executor nor is it the
> ThreadDeath-Exception, but the dependency of the processes at startup.

I'm not sure I follow this sentence. 
Maven uses a thread executor to use http connections in parallel. it's not configurable from the outside. On top of it, it's not straightforward to cancel the http connections. We use the transfer listener for that and throw ThreadDeath exception to terminate the http connections. We catch ThreadDeath in out directly accessed threads that spawn the downloads. maven doesn't properly delegate the exception from one thread to the other.

> 
> The ThreadDeath-Exception is just a follow up. The main cause of this bug
> report is the poor and slowly start of netbeans with some count of projects,
> due to the "Download Maven Dependency" blocks the execution of all the other
> threads at startup.

In what way does the download task slow netbeans start up? Too much IO? too many threads occupied? please provide additional information, like a thread dump.
Also please note that in order to have Download action triggered on startup, you must have turned it on manually in Tools/Options -> Maven. There is a label warning against exactly the problem you are encountering. And that's why it's turned off by default.


> 
> So please change the dependencies and do not assume a fast internet
> connection for "download maven dependencies".

what do you mean by "change the dependencies"?


please reopen with additional information
Comment 5 rherschke 2014-02-17 13:34:28 UTC
(1) the default for this is "Every Project Open", not "Never" as you stated. This might come from migration of netbeans since 5.x, but I'm sure, never changed these options ever.

(2) the process "Opening Projects" WAITS for finished execution of "Download Maven Dependencies" --> This should not be the case! A project COULD be opened WITHOUT waiting for all dependencies downloads. And exactly this slow down the startup.

In other words:

"Download Maven Dependencies" should be a "real" Background process without any other processes waiting for the end of this process! The same for "Download Sources" and "Download Javadocs"

The Projects SHOULD be opened immediately, independent if they compile or not (due to yet missing dependencies). If all projects are opened THEN the download may be start in background, not disturbing any other IDE actions as it does now.

This use-case does not depend on the Download-Strategy defined in the settings! Never ever the download-strategy must block the Opening Project process!!! But it does so now --> With >90% CPU-Usage!

(3) Due to I don't want to wait for Dependency-Downloads when Internet is slow, I like to cancel this process nevertheless. But I cannot - due to the ThreadDeath mentioned.

I understand, that canceling this Process will not work. But I do not understand, why all the other processes - will have to wait for downloading dependencies.

And: Since I'm working at many different places - some with fast connections, some with mobile connections, some without internet connections, I don't want to be tighten on any "Download Strategy" set up once in the Settings. I like to ALWAYS have a FAST STARTING NETBEANS without any inconveniences depending on wether or not the internet connection is fast enough to let netbeans quickly download dependencies.

Thats why the Startup-Processes MUST not be dependent on the "Download Maven Dependencies": FIRST make sure, all projects are opened and sources are editable - THEN in the background the "Download Maven Dependencies" might be triggered as set up in the Download-Strategy-Comboboxes in the Settings. 

Now it is just a hard dependency - so before anything works, netbeans ever tries to download maven dependencies and javadoc and sources and blocks any other usage of the IDE.
Comment 6 Milos Kleint 2014-02-17 13:59:27 UTC
(In reply to rherschke from comment #5)
> (1) the default for this is "Every Project Open", not "Never" as you stated.
> This might come from migration of netbeans since 5.x, but I'm sure, never
> changed these options ever.

since a very long time Never is the default. I cannot deduce how you got the "every project open" but a plain import won't cut it (if that was the default in 5.x, then nothing would be imported as nothing would be stored in the user directory as far as I can remember - unless preference storage was different in 5.x)

The binary download is indeed synchronous (which surprised me actually), likely a relict of the past when the global classpath reacted badly to repeated changes of classpath after downloads of dependencies. Changing the summary accordingly, not for 8.0, the workaround is to never download anything on startup/project open and perform the dependency downloads automatically.
Comment 7 Martin Balin 2016-07-07 08:37:52 UTC
This old bug may not be relevant anymore. If you can still reproduce it in 8.2 development builds please reopen this issue.

Thanks for your cooperation,
NetBeans IDE 8.2 Release Boss