VirtusLab / ide-probe

Apache License 2.0
26 stars 13 forks source link

Linux: when tests (Gradle, JUnit, Xvfb display, v0.34.0) are killed with Ctrl+C locally, tested IDE keeps running in the background #211

Open PawelLipski opened 2 years ago

PawelLipski commented 2 years ago

org.virtuslab.ideprobe.IntelliJFixture#startIntelliJ has Runtime.getRuntime.addShutdownHook(new Thread(() => runningIde.shutdown())), so theoretically the IDE should always get killed... but I observe that IDEs accumulate from Gradle runs that's been killed with Ctrl+C 🤔

lukaszwawrzyk commented 2 years ago

It is on jvm shutdown, maybe jvm that is used for tests keeps running? Maybe it is the gradle daemon that just aborts the task. Are you forking the jvm for tests?

PawelLipski commented 2 years ago

Okay... I can't reproduce it myself now indeed 😅 lemme close, maybe I was wrong

PawelLipski commented 2 years ago

Whoops no, quite a lot of IDEs running 😅 Maybe a matter of running them under xvfb-run?

$ jps -mlv | grep /tmp/ide-probe/
936142 com.intellij.idea.Main -Djava.awt.headless=false -Djb.privacy.policy.text=<!--999.999--> -Djb.consents.confirmation.enabled=false -Drobot-server.port=33819 --add-opens=java.base/jdk.internal.misc=ALL-UNNAMED -Dio.netty.transport.noNative=true -Dio.netty.tryReflectionSetAccessible=true -Xmx1G -XX:ErrorFile=/home/plipski/java_error_in_idea_%p.log -XX:HeapDumpPath=/home/plipski/java_error_in_idea_.hprof -Djb.vmOptionsFile=/tmp/ide-probe/instances/intellij-instance-2022.1.1--WRwkWvpISf6UgPwPa2wYTw/bin/ideprobe.vmoptions -Didea.properties.file=/tmp/ide-probe/instances/intellij-instance-2022.1.1--WRwkWvpISf6UgPwPa2wYTw/bin/idea.properties -Djava.system.class.loader=com.intellij.util.lang.PathClassLoader -Didea.strict.classpath=true -Didea.vendor.name=JetBrains -Didea.paths.selector=IdeaIC2022.1 -Didea.platform.prefix=Idea -Didea.jre.check=true -Dsplash=true
531451 com.intellij.idea.Main -Djava.awt.headless=false -Djb.privacy.policy.text=<!--999.999--> -Djb.consents.confirmation.enabled=false -Drobot-server.port=33809 --add-opens=java.base/jdk.internal.misc=ALL-UNNAMED -Dio.netty.transport.noNative=true -Dio.netty.tryReflectionSetAccessible=true -Xmx1G -XX:ErrorFile=/home/plipski/java_error_in_idea_%p.log -XX:HeapDumpPath=/home/plipski/java_error_in_idea_.hprof -Djb.vmOptionsFile=/tmp/ide-probe/instances/intellij-instance-2022.1--ajB5uWUiSNavJCwpKkdj8Q/bin/ideprobe.vmoptions -Didea.properties.file=/tmp/ide-probe/instances/intellij-instance-2022.1--ajB5uWUiSNavJCwpKkdj8Q/bin/idea.properties -Djava.system.class.loader=com.intellij.util.lang.PathClassLoader -Didea.strict.classpath=true -Didea.vendor.name=JetBrains -Didea.paths.selector=IdeaIC2022.1 -Didea.platform.prefix=Idea -Didea.jre.check=true -Dsplash=true
939883 com.intellij.idea.Main -Djava.awt.headless=false -Djb.privacy.policy.text=<!--999.999--> -Djb.consents.confirmation.enabled=false -Drobot-server.port=35617 --add-opens=java.base/jdk.internal.misc=ALL-UNNAMED -Dio.netty.transport.noNative=true -Dio.netty.tryReflectionSetAccessible=true -Xmx1G -XX:ErrorFile=/home/plipski/java_error_in_idea_%p.log -XX:HeapDumpPath=/home/plipski/java_error_in_idea_.hprof -Djb.vmOptionsFile=/tmp/ide-probe/instances/intellij-instance-2022.1.1--kKquLfgTQVaYWIs7NLmCdQ/bin/ideprobe.vmoptions -Didea.properties.file=/tmp/ide-probe/instances/intellij-instance-2022.1.1--kKquLfgTQVaYWIs7NLmCdQ/bin/idea.properties -Djava.system.class.loader=com.intellij.util.lang.PathClassLoader -Didea.strict.classpath=true -Didea.vendor.name=JetBrains -Didea.paths.selector=IdeaIC2022.1 -Didea.platform.prefix=Idea -Didea.jre.check=true -Dsplash=true
1697552 com.intellij.idea.Main -Djava.awt.headless=false -Djb.privacy.policy.text=<!--999.999--> -Djb.consents.confirmation.enabled=false -Drobot-server.port=37829 -XX:ErrorFile=/home/plipski/java_error_in_idea_%p.log -XX:HeapDumpPath=/home/plipski/java_error_in_idea_.hprof -Djb.vmOptionsFile=/tmp/ide-probe/instances/intellij-instance-222.3244.4-EAP-SNAPSHOT--JaayY_b4RXGqCYaHGQ3OJA/bin/ideprobe.vmoptions -Didea.properties.file=/tmp/ide-probe/instances/intellij-instance-222.3244.4-EAP-SNAPSHOT--JaayY_b4RXGqCYaHGQ3OJA/bin/idea.properties -Djava.system.class.loader=com.intellij.util.lang.PathClassLoader -Didea.strict.classpath=true -Didea.vendor.name=JetBrains -Didea.paths.selector=IdeaIC2022.2 -Didea.platform.prefix=Idea -Didea.jre.check=true -Dsplash=true --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.nio=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=jav
532194 com.intellij.idea.Main -Djava.awt.headless=false -Djb.privacy.policy.text=<!--999.999--> -Djb.consents.confirmation.enabled=false -Drobot-server.port=40443 --add-opens=java.base/jdk.internal.misc=ALL-UNNAMED -Dio.netty.transport.noNative=true -Dio.netty.tryReflectionSetAccessible=true -Xmx1G -XX:ErrorFile=/home/plipski/java_error_in_idea_%p.log -XX:HeapDumpPath=/home/plipski/java_error_in_idea_.hprof -Djb.vmOptionsFile=/tmp/ide-probe/instances/intellij-instance-2022.1--Zprw36e5S4maTY0SgArd1Q/bin/ideprobe.vmoptions -Didea.properties.file=/tmp/ide-probe/instances/intellij-instance-2022.1--Zprw36e5S4maTY0SgArd1Q/bin/idea.properties -Djava.system.class.loader=com.intellij.util.lang.PathClassLoader -Didea.strict.classpath=true -Didea.vendor.name=JetBrains -Didea.paths.selector=IdeaIC2022.1 -Didea.platform.prefix=Idea -Didea.jre.check=true -Dsplash=true
LukaszKontowski commented 2 years ago

Hm 🤔 Looks like such issue does not exist anymore? Or maybe it exists only on linux machines? I did the test with Crtrl+c using one UI test from git-machete-intellij-plugin. And the process has been killed the same moment I used Ctrl+c

./gradlew -Ptests=pullBranch uiTest -Dorg.gradle.java.home=/opt/homebrew/Cellar/openjdk@11/11.0.16

lkontowski@lkontowski-MacBook-Pro /Users/lkontowski/code/git-machete-intellij-plugin [develop]
% ./gradlew -Ptests=pullBranch uiTest -Dorg.gradle.java.home=/opt/homebrew/Cellar/openjdk@11/11.0.16

> Task :verifyPluginConfiguration
[gradle-intellij-plugin :git-machete-intellij-plugin:verifyPluginConfiguration] The following plugin configuration issues were found:
- The 'since-build' property is lower than the target IntelliJ Platform major version: 221 < 222.
- The Java configuration specifies sourceCompatibility=11 but IntelliJ Platform 2022.2.1 requires sourceCompatibility=17.
See: https://jb.gg/intellij-platform-versions

> Task :uiTest_2022.2.1

com.virtuslab.gitmachete.uitest.UITestSuite STANDARD_OUT
    Installing IntelliJ(2022.2.1)
    Fetching https://www.jetbrains.com/intellij-repository/releases/com/jetbrains/intellij/idea/ideaIC/2022.2.1/ideaIC-2022.2.1.zip into /var/folders/6j/141ys4_178d0r360cfsvg7g40000gn/T/ide-probe/cache/bb6c91037612dab2e5b4d2269e5cbe1c
<============-> 98% EXECUTING [4s]
> :uiTest_2022.2.1 > 0 tests completed
> IDLE
> IDLE
> IDLE
> IDLE
> IDLE
> :uiTest_2022.2.1 > Executing test com.virtuslab.gitmachete.uitest.UITestSuite
> IDLE
^C%                                                                                                                                                                                                                         lkontowski@lkontowski-MacBook-Pro /Users/lkontowski/code/git-machete-intellij-plugin [develop]
% jps -mlv | grep /tmp/ide-probe/                                                                   
lkontowski@lkontowski-MacBook-Pro /Users/lkontowski/code/git-machete-intellij-plugin [develop]
% jps
5984 GradleDaemon
6129 Jps
1403 
LukaszKontowski commented 2 years ago

or maybe it depends on when user tries to kill the process with Ctrl+c ?

LukaszKontowski commented 2 years ago

ok, when I kill it later, after IntelliJ startup - in fact some process still lives - GradleWorkerMain

% jps                            
5984 GradleDaemon
7970 Jps
6183 GradleWorkerMain
1403 
PawelLipski commented 2 years ago

GradleWorkerMain is well expected... the problem is with Main (i.e. IntelliJ) JVM process sticking around. Okay, let's leave as is, this might indeed only affect local runs on Linux machines

PawelLipski commented 1 year ago

Yeah, I switched to mac recently, cannot not reproduce the problem anymore. Lemme update the issue title...