importing Gradle project: insanely slow

已回答

Hi,

 

I'm using IntelliJ IDEA Ultimate 2020.1

 

Importing/re-importing a Gradle project in IntelliJ takes about 10 mins for me. This is a very small project with few dependencies. While it is importing, all I see is this:

It is not giving me any indication what it is spending all of the time on. I'm convinced that the problem has something to do with my specific IntelliJ or OS configuration because:

1) After changes to the Gradle model, command line builds take seconds-- so the problem appears only in IntelliJ, not on the command line.

2) I'm the only person on my team to have this problem. Several other engineers are working with the exact same project, in the exact same version of IDEA that I"m' using, but Gradle imports/re-imports are really fast for them.

 

Is there a way I can get some visibility into what IDEA is actually doing during this time?

 

thanks,

 

Joe

0

What messages do you see in the IDE status bar and in Build | Sync log on the right when it happens?

Try getting the thread dumps using jstack for the external process that runs Gradle import. The dumps will show what the process is doing. It could be some VPN/proxy configuration making your dependencies resolution slow. See https://intellij-support.jetbrains.com/hc/articles/206544899.

1
Avatar
Permanently deleted user

Hi Serge,

 

Thanks for the pointers. This is what I see on status bar:

and this is what I see in Build|Synch log:

with lots of entries that look like this:

Those entries are all generated instantaneously.

 

When I Gradle reimport from IDEA, it launches this GradleDaemon:

63878 GradleDaemon 6.3 -XX:MaxMetaspaceSize=256m -XX:+HeapDumpOnOutOfMemoryError --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED -Xms256m -Xmx512m -Dfile.encoding=UTF-8 -Duser.country=US -Duser.language=en -Duser.variant

I took a threadump of that process 1 min and 5 mins after launch. I can send them to you if it will help diagnosis. Looking at the dumps, it's not obvious to me what the problem is.

 

0

I'd recommend reporting a bug at https://youtrack.jetbrains.com/newIssue?project=IDEA and attaching all the files there. It would be easier to process and share files than here.

0
Avatar
Permanently deleted user

The trick I have found is to build the gradle project off line once to get it to suck down all the dependencies.  Then go back into IDEA and set gradle to "offline" mode and then run the import.  It will then run in seconds.

6

Most likely something in your network configuration (dns/proxy/firewall/antivirus) makes internet hosts resolution/downloading slow. Check your hosts file - make sure the only mapping to localhost is 127.0.0.1 like '127.0.0.1 localhost'

If you have antivirus/firewall, try with it disabled or make sure the IDE settings directories IDE installation home, the IDE executable and project files are excluded from the scan.

If you have proxy, check that is it configured in Settings (Preferences on macOS) | Appearance & Behavior | System Settings | HTTP Proxy settings as well as in Gradle build/settings files.

If issue remains, please file a YouTrack issue with IDE logs (Help | Collect Logs and Diagnostic Data action) and jstack thread dumps of org.gradle.launcher.daemon.bootstrap.GradleDaemon Gradle daemon importing process. Thank you.

1

Charles thank you so much, the offline trick works! Previously the gradle would run 32 min once I changed one of the dependencies. Now it only runs 18 secs!

0

Offline trick works, but for me it was a forgotten proxy configuration in the settings. Thanks Andrey Dernov

0
Avatar
Permanently deleted user

Charles is a life savor!

0

In 6.8.1 I can see that Intellij is reaching out to resources.jetbrains.com and jetbrains.bintray.com 

This is despite me including an internal distro of gradle in my distribution Url.

So behind a corp proxy doing a project load in Intellij is terminally slow.

We are downgrading to 5.8.x as this does not exhibit this error.

I cannot hack my hosts file BTW so that's not a fix.

Any fix from the Vendor?

0

John Lonergan

I see you already submitted a corresponding ticket to YouTrack: https://youtrack.jetbrains.com/issue/IDEA-273346

Please find a reply there.

0

Charles 真是太棒了 !开启离线模式之后速度超快,不超过 1 分钟,平时都在 50 分钟起步...

1

Thanks the tricks from Charles! It works

0

请先登录再写评论。