Re-importing gradle projects takes several minutes
Answered
This only started about 2 months ago and it's been driving me crazy.
We have a project with quite a lot of modules but re-import use to take 10-15 sec', but now it takes 5+ minutes, I've tried looking at the logs but I can't find anything useful there.
Ubuntu 18.04
IntelliJ 2019.2.3
Please sign in to leave a comment.
Idea.log
2019-10-30 15:52:04,991 [104414891] INFO - s.plugins.gradle.GradleManager - Instructing gradle to use java from /usr/lib/jvm/jdk-11.0.2
2019-10-30 15:52:04,993 [104414893] INFO - s.plugins.gradle.GradleManager - Instructing gradle to use java from /usr/lib/jvm/jdk-11.0.2
2019-10-30 15:52:05,024 [104414924] INFO - xecution.GradleExecutionHelper - Passing command-line args to Gradle Tooling API: -Didea.sync.active=true -Didea.resolveSourceSetDependencies=true --init-script /tmp/ijinit.gradle
2019-10-30 15:52:06,496 [104416396] INFO - rationStore.ComponentStoreImpl - Saving appVcsApplicationSettings took 15 ms
2019-10-30 15:52:06,519 [104416419] INFO - rationStore.ComponentStoreImpl - Saving Module: 'crl8-modules.crl8-bookkeeper-integration.main'ExternalSystem took 16 ms
2019-10-30 15:52:06,548 [104416448] INFO - rationStore.ComponentStoreImpl - Saving Module: 'crl8-modules.crl8-common-persistence.test'ExternalFacetManager took 17 ms
2019-10-30 15:52:06,587 [104416487] INFO - rationStore.ComponentStoreImpl - Saving Module: 'crl8-modules.crl8-dispatcher-integration.test'ExternalFacetManager took 17 ms
2019-10-30 15:52:06,694 [104416594] INFO - rationStore.ComponentStoreImpl - Saving Module: 'crl8-modules.crl8-pricing.test'ExternalSystem took 11 ms
2019-10-30 15:52:06,748 [104416648] INFO - rationStore.ComponentStoreImpl - Saving Module: 'crl8-modules.crl8-violation-manager-module.test'TestModuleProperties took 17 ms
2019-10-30 15:52:06,830 [104416730] INFO - rationStore.ComponentStoreImpl - Saving Module: 'crl8-prometheus.test'ExternalSystem took 15 ms
2019-10-30 15:52:06,843 [104416743] INFO - mponents.impl.stores.StoreUtil - saveProjectsAndApp took 373 ms
2019-10-30 15:55:12,608 [104602508] INFO - mponents.impl.stores.StoreUtil - saveProjectsAndApp took 210 ms
2019-10-30 15:55:24,943 [104614843] INFO - rationStore.ComponentStoreImpl - Saving Module: 'crl8-modules.crl8-common-entities'ExternalSystem took 13 ms
2019-10-30 15:55:25,086 [104614986] INFO - mponents.impl.stores.StoreUtil - saveProjectsAndApp took 214 ms
2019-10-30 15:55:35,818 [104625718] INFO - rationStore.ComponentStoreImpl - Saving Module: 'crl8-modules.crl8-bookkeeper.main'ExternalFacetManager took 28 ms
2019-10-30 15:55:35,972 [104625872] INFO - mponents.impl.stores.StoreUtil - saveProjectsAndApp took 266 ms
2019-10-30 15:55:52,798 [104642698] INFO - rationStore.ComponentStoreImpl - Saving Module: 'crl8-modules.crl8-bookkeeper-module.test'ExternalFacetManager took 13 ms
2019-10-30 15:55:52,937 [104642837] INFO - mponents.impl.stores.StoreUtil - saveProjectsAndApp took 161 ms
2019-10-30 15:55:59,564 [104649464] INFO - rationStore.ComponentStoreImpl - Saving Project '/home/tomer/dev/crl8/trading-platform/crl8-prometheus' crl8-prometheusRunManager took 11 ms
2019-10-30 15:55:59,564 [104649464] INFO - mponents.impl.stores.StoreUtil - saveProjectsAndApp took 175 ms
2019-10-30 15:57:35,164 [104745064] INFO - rationStore.ComponentStoreImpl - Saving Module: 'crl8-modules.crl8-portfolio-manager.main'ExternalSystem took 13 ms
2019-10-30 15:57:35,251 [104745151] INFO - mponents.impl.stores.StoreUtil - saveProjectsAndApp took 212 ms
2019-10-30 15:57:39,061 [104748961] INFO - rationStore.ComponentStoreImpl - Saving Module: 'crl8-modules.crl8-bookkeeper-integration.main'ExternalFacetManager took 11 ms
2019-10-30 15:57:39,207 [104749107] INFO - mponents.impl.stores.StoreUtil - saveProjectsAndApp took 204 ms
2019-10-30 15:57:56,804 [104766704] INFO - mponents.impl.stores.StoreUtil - saveProjectsAndApp took 185 ms
2019-10-30 15:58:03,867 [104773767] INFO - System.util.ExternalSystemUtil - External project [/home/tomer/dev/crl8/trading-platform/crl8-modules] resolution task executed in 358878 ms.
2019-10-30 15:58:04,101 [104774001] INFO - ge.ExternalProjectsDataStorage - Save external projects data in 247 ms
2019-10-30 15:58:04,138 [104774038] INFO - mponents.impl.stores.StoreUtil - saveProjectsAndApp took 453 ms
2019-10-30 15:58:04,245 [104774145] INFO - rationStore.ComponentStoreImpl - Saving Module: 'crl8-modules.crl8-pricing.main'ExternalFacetManager took 19 ms
2019-10-30 15:58:04,288 [104774188] INFO - rationStore.ComponentStoreImpl - Saving Module: 'crl8-modules.crl8-trades-manager.test'ExternalFacetManager took 12 ms
2019-10-30 15:58:04,625 [104774525] INFO - ge.ExternalProjectsDataStorage - Save external projects data in 318 ms
2019-10-30 15:58:04,646 [104774546] INFO - mponents.impl.stores.StoreUtil - saveProjectsAndApp took 508 ms
2019-10-30 15:58:05,925 [104775825] INFO - pl.ProjectRootManagerComponent - project roots have changed
2019-10-30 15:58:06,024 [104775924] INFO - .diagnostic.PerformanceWatcher - Pushing properties took 19ms; general responsiveness: ok; EDT responsiveness: ok
2019-10-30 15:58:06,363 [104776263] INFO - .diagnostic.PerformanceWatcher - Indexable file iteration took 339ms; general responsiveness: ok; EDT responsiveness: ok
2019-10-30 15:58:06,901 [104776801] INFO - pl.projectlevelman.NewMappings - Mapped Roots: 1
2019-10-30 15:58:10,657 [104780557] INFO - mponents.impl.stores.StoreUtil - saveProjectsAndApp took 281 ms
Gradle daemon log
Do you have antivirus/firewall? How long does Gradle build itself take (from command line and from IDE)? Do you have network mounts?
Try if it makes a difference using different Gradle and/or JDK version for Gradle.
Please add
lines into Help | Debug Log Settings... dialog reproduce the problem and provide idea.log. For uploading you can use ftp://ftp.intellij.net/.uploads / https://uploads.services.jetbrains.com or any file sharing service.
Hi Andrey
No AV/Firewall, no network mounts.
I've tried different Gradle version but there is no difference, same with JDK version.
The build itself is fine, takes about 2 min' with the IDEA (clean build) and about the same time from the command line - It's a big project (10 projects) so 2 min' is expected for a clean build.
I've uploaded the idea.log with the debug settings you've suggested using https://uploads.services.jetbrains.com/ but i'm not sure what's the address of that file.
The file name is: idea-debug-gradle-issue.log , But since I'm not sure this worked I'm also pasting the log it self here.
It seems to me that the critical issue is this line:
And this is the full log:
I've also encountered those errors during one of the tests, I'm not sure if it's related or not:
Thanks!
You need to have this exact line in Debug lLog settings dialog:
#org.jetbrains.plugins.gradle.service.project.data.PerformanceTraceDataServicewith the hash in front. I see you only added the
org.jetbrains.plugins.gradle.service.project.data.PerformanceTraceDataServiceone. Please add these two lines reproduce and re-upload the log. Thanks.
Oops, thought the line with the hash at front was commented out line :)
The correct file is here: http://s000.tinyupload.com/index.php?file_id=22535873795952348664
Sorry for a delayed reply.
>Gradle data obtained: 374198 ms.
This is a time took for Gradle daemon to process and give data to IDE. With such numbers I'm not sure that this regression could be caused by the IDE update.
Did you always use separate modules per Gradle source set option? It could introduce some overhead in case of very large projects but this overhead is still not compared with the numbers you mention, looking in logs - at max it could add a minute.
Could it be that the build itself has changed? Can you compare it with the IDE version where you did not experience this problem?
Could it be that dependencies resolve and downloading that takes time? E.g. a slow network or DNS resolutions. You can e.g. try enabling an Offline mode in Gradle tool window and try re-import.
In general we plan to redesign current project model for external system projects like Gradle, Maven. So costs like
>Get model IdeaProject : 155137 ms.
could be almost eliminated. But this is a scope of 2020.X versions.
Hi Andrey, thanks again for the detailed response.
It seems that switching to Offline mode "fixes" the issue and reduce the re-import time to a few seconds.
Unfortunately a lot of our dependencies are being served from a remote repositories so this is not a viable option for me for most of the time :/
Any suggestions on how to investigate this issue?
To see what exactly takes the time you can by taking jstack thread dumps of java IDE process and external Gradle daemon process which runs the Gradle: https://intellij-support.jetbrains.com/hc/en-us/articles/206544899 to see what exactly IDE and Gradle daemon processes are doing. You can find the `GradleDaemon` process from command line using ps utility e.g. ps auxww | grep gradle to find out the PID and take several jstack dumps of it at the moment of execution.
Such issues are usually caused by Antivirus/firewall or network (dns) misconfiguration - when process takes long time to resolve the host when is trying to connect.