简体   繁体   English

Eclipse Gradle插件产生了数百个进程

[英]Eclipse Gradle plugin spawning hundreds of processes

When I start Eclipse with the Gradle plugin on, sometimes literally hundreds of Java processes will suddenly spawn. 当我使用Gradle插件启动Eclipse时,有时实际上会突然产生数百个Java进程。 They look like this: 他们看起来像这样:

26000 pts/24 Sl 0:01 /usr/lib/jvm/default-java//bin/java -Dfile.encoding=utf-8 -Xmx512m -XX:MaxPermSize=128m -XX:+UseG1GC -Dorg.gradle.appname=gradlew -classpath /[...]/gradle/wrapper/gradle-wrapper.jar org.gradle.wrapper.GradleWrapperMain [project name]:eclipseExternalBuild --configure-on-demand -Dorg.gradle.parallel=false 26000 pts / 24 Sl 0:01 / usr / lib / jvm / default-java // bin / java -Dfile.encoding = utf-8 -Xmx512m -XX:MaxPermSize = 128m -XX:+ UseG1GC -Dorg.gradle.appname = gradlew -classpath /[...]/gradle/wrapper/gradle-wrapper.jar org.gradle.wrapper.GradleWrapperMain [项目名称]:eclipseExternalBuild-按需配置-Dorg.gradle.parallel = false

26230 pts/24 Sl 0:04 /usr/lib/jvm/jdk1.7.0_51/bin/java -XX:MaxPermSize=2048m -Xmx4096m -Dfile.encoding=UTF-8 -cp [...]/.gradle/wrapper/dists/gradle-1.8-all/2kopnp0i5dq014k75fp36m3vd5/gradle-1.8/lib/gradle-launcher-1.8.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 1.8 [...]/.gradle/daemon 10800000 4d4119b1-c332-4714-b0cd-1e80bc6dd78f -XX:MaxPermSize=2048m -Xmx4096m -Dfile.encoding=UTF-8 26230 pts / 24 Sl 0:04 /usr/lib/jvm/jdk1.7.0_51/bin/java -XX:MaxPermSize = 2048m -Xmx4096m -Dfile.encoding = UTF-8 -cp [...] /。gradle /包装器/dists/gradle-1.8-all/2kopnp0i5dq014k75fp36m3vd5/gradle-1.8/lib/gradle-launcher-1.8.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 1.8 [...] /。gradle / daemon 10800000 4d4119b1- c332-4714-b0cd-1e80bc6dd78f -XX:MaxPermSize = 2048m -Xmx4096m -Dfile.encoding = UTF-8

The first kind of process looks like Eclipse is building things; 第一种过程看起来像Eclipse在构建事物。 there seems to be at least one (sometimes up to 6!!) process for each project within my workspace. 我的工作区中的每个项目似乎至少有一个过程(有时多达6个!)。 They go away after a few minutes, which is reasonable. 他们在几分钟后消失了,这是合理的。

What is annoying is that I have no idea what all the GradleDaemon s are doing. 令人讨厌的是,我不知道所有GradleDaemon都在做什么。

Gradle dependency management is enabled within Eclipse. 在Eclipse中启用了Gradle依赖性管理。 I'm using Eclipse 4.4 and Gradle 1.8 on Ubuntu 14.04. 我在Ubuntu 14.04上使用Eclipse 4.4和Gradle 1.8。

How do I fix this? 我该如何解决? I'm basically calling killall -9 java every few hours when my computer starts being unresponsive. 当我的计算机开始无响应时,我基本上每隔几个小时就会调用killall -9 java

I don't know if I can fix the problem for you but at least I can give you guidance about some things here. 我不知道我是否可以为您解决问题,但至少我可以在这里为您提供一些指导。 The first set of daemon processes after Eclipse launch is created to obtain model of a project to populate classpath of your projects. 创建Eclipse启动后的第一组守护进程,以获取项目模型以填充项目的类路径。 They are likely to have some short timeout if they die quickly. 如果他们很快死掉,他们可能会有一些短暂的超时。

Process 26000 looks more like a command line invocation to me than a process initiated by Eclipse plugin. 对我而言,进程26000看起来更像是命令行调用,而不是Eclipse插件启动的进程。 Two consecutive slashes in /usr/lib/jvm/default-java//bin/java seems weird to me. /usr/lib/jvm/default-java//bin/java两个连续的斜杠对我来说似乎很奇怪。 Do you have JAVA_HOME set with a trailing slash? 您是否在JAVA_HOME中设置了斜杠?

If you have so many processes running simultaneously then each build request probably starts a new one with 3 hours timeout (10800000 millis parameter in the output). 如果您有这么多进程同时运行,则每个构建请求都可能会启动一个新超时3小时的超时请求(输出中为10800000 millis参数)。 You can customize the timeout using a system property but it would be better to find why Gradle is not reusing an already running daemon process. 您可以使用系统属性自定义超时,但是最好找到Gradle为什么不重用已经运行的守护进程的原因。 It should do it assuming that the daemon uses the same JVM, same set of JVM args and possibly some other constraints. 假设守护程序使用相同的JVM,相同的JVM参数集以及可能存在其他一些约束,则应这样做。 There are logs in Gradle user home directory that you can check for any suspicious messages. Gradle用户主目录中有日志,您可以检查任何可疑消息。

Also I'd check some of these process using a thread dump to see if there is deadlock/starvation preventing it from normal processing. 另外,我还将使用线程转储检查其中一些过程,以查看是否存在死锁/饥饿,从而阻止其正常处理。 Ie if they do not finish their build execution they won't be reused for next build request and maybe they will not quit after timeout. 即,如果他们没有完成构建执行,则它们将不会再用于下一个构建请求,并且可能在超时后也不会退出。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM