You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2021/07/05 00:52:47 UTC

[GitHub] [maven-surefire] kriegaex edited a comment on pull request #355: [SUREFIRE-1881] - Fix and extend integration test

kriegaex edited a comment on pull request #355:
URL: https://github.com/apache/maven-surefire/pull/355#issuecomment-873703758


   > You did not take my commit with the fix. Your HEAD commit in your repository contains your tests without the fix. So it is quite irrelevant.
   
   What are you talking about?
   
   ![image](https://user-images.githubusercontent.com/1537384/124403579-5efae800-dd61-11eb-818d-dac622c75d0b.png)
   
   You should read my PR correctly. The PR of course builds on top of your fixes, I branched it off of master. Please revert and merge my PR as prior art instead. I did this work, you were simply recreating it. These are my commits and I want them merged. If something is wrong with my PR, we can fix them, of course. The other branch without the fixes simply shows what would happen if
      * we overlooked an endge case or
      * accidentally the problem gets re-introduced in the future by someone elses change or refactoring.
   
   This IT is meant to do two things:
     * verify some assumptions about how the application should behave
     * reproduce a problem, spotting regressions, in case it does not behave as expected
   
   So testing what would happen if the test actually would run into a timeout due to a regression is very much relevant. I simply created the other branch for your convenience, so you can reproduce the problem with hanging JVMs not being cleaned up properly. That other branch is not a PR branch, this one is!
   
   > Nobody is watching Windows task manager in order to send some proves because this is false representation.
   
   Of course not, normally people just run the IT, relying on it behaving correctly. Cleaning up resources and fixtures is part of a test's correct behaviour, and I manually verified that for you. I noticed that resource clean-up is broken, which is why it should be fixed, because otherwise people **not** looking at a task manager or `htop` would never notice what is going on, until all the running processes from repeatedly running tests would cause out of memory errors on their workstations or CI servers.
   
   > Instead, the developers use the command-line
   
   Different developers use different tools. If the tool reveals the correct information, why does it matter if I started it from a console or from an IDE? Besides, I did run the test from Maven(!), simply used a GUI tool to watch what Maven does live. In that tool, I cannot just see the end result but also what happens during the test: First, each of the two Java process groups are indirect children of sh.exe (my Git Bash), which starts the Maven build. Then, each time one of the two tests is interrupted due to the timeouts, the subprocesses lose their parent (of course) and now move up the process hierarchy, hanging there as zombies without parents. Your `wmic` shows the same information, only with less detail, because the fact that it is not just Java processes but a group of 4 processes per test case is missing. My simple screenshot illustrates that way better.
   
   You made a similar argument about my Process Explorer screenshot in the original Jira ticket, trying to fend off my information as irrelevant, claiming the Java agent to be the problem instead of Surefire. Like back then, you are also wrong in this case: The problem is real, my screenshot illustrates it you can easily reproduce it in my test branch. Of course, currently there is no known regression, but no software is perfect and regressions can always occur. To ensure that the ITs clean up their resources in case they fail due to a hanging JVM (which is exactly what they test should **not** happen), is part of the job of writing tests. So the job is not done yet.
   
   But if it makes you happy, I replayed again on the console for you (ran inside the IT module after a previous full build with install):
   
   ```none
   $ mvn -P run-its verify
   (...)
   [INFO] -------------------------------------------------------
   [INFO]  T E S T S
   [INFO] -------------------------------------------------------
   [INFO] Running org.apache.maven.surefire.its.jiras.Surefire1881IT
   [ERROR] Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 60.054 s <<< FAILURE! - in org.apache.maven.surefire.its.jiras.Surefire1881IT
   [ERROR] org.apache.maven.surefire.its.jiras.Surefire1881IT.testJVMLogging  Time elapsed: 30.011 s  <<< ERROR!
   org.junit.runners.model.TestTimedOutException: test timed out after 30000 milliseconds
           at app//org.apache.maven.surefire.its.jiras.Surefire1881IT.testJVMLogging(Surefire1881IT.java:37)
   
   [ERROR] org.apache.maven.surefire.its.jiras.Surefire1881IT.testJavaAgent  Time elapsed: 30.011 s  <<< ERROR!
   org.junit.runners.model.TestTimedOutException: test timed out after 30000 milliseconds
           at app//org.apache.maven.surefire.its.jiras.Surefire1881IT.testJavaAgent(Surefire1881IT.java:47)
   
   [INFO]
   [INFO] Results:
   [INFO]
   [ERROR] Errors:
   [ERROR]   Surefire1881IT.testJVMLogging:37 » TestTimedOut test timed out after 30000 mil...
   [ERROR]   Surefire1881IT.testJavaAgent:47 » TestTimedOut test timed out after 30000 mill...
   [INFO]
   [ERROR] Tests run: 2, Failures: 0, Errors: 2, Skipped: 0
   (...)
   
   $ wmic PROCESS where "name like '%java%'" get Commandline
   CommandLine                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
   "C:\Program Files\Java\jdk-16\bin\java.exe"        -Dfile.encoding=UTF-8      -classpath "C:\Program Files\Java\apache-maven-3.6.3\bin\..\boot\plexus-classworlds-2.6.0.jar"   "-Dclassworlds.conf=C:\Program Files\Java\apache-maven-3.6.3\bin\..\bin\m2.conf"   "-Dmaven.home=C:\Program Files\Java\apache-maven-3.6.3\bin\.."   "-Dlibrary.jansi.path=C:\Program Files\Java\apache-maven-3.6.3\bin\..\lib\jansi-native"   "-Dmaven.multiModuleProjectDirectory=C:\Users\alexa\Documents\java-src\maven-surefire\surefire-its\target\Surefire1881IT_testJVMLogging"   org.codehaus.plexus.classworlds.launcher.Launcher -e --batch-mode -Dmaven.repo.local=C:\Users\alexa\.m2\repository org.apache.maven.plugins:maven-clean-plugin:clean -Dsurefire.version=3.0.0-M6-SNAPSHOT -Djacoco.agent=-javaagent:C:\\Users\\alexa\\.m2\\repository\\org\\jacoco\\org.jacoco.agent\\0.8.7\\org.jacoco.agent-0.8.7-runtime.jar=destfile=C:\\Users\\alexa\\Documents\\java-src\\maven-surefire\\surefire-its\\target\\jacoco-it.exec,includ
 es=**/failsafe/*:**/failsafe/**/*:**/surefire/*:**/surefire/**/*,excludes=**/HelpMojo.class:**/shadefire/**/*:org/jacoco/**/*:com/vladium/emma/rt/* -Dhttps.protocols=TLSv1,TLSv1.1,TLSv1.2 -nsu test
   "C:\Program Files\Java\jdk-16\bin\java"  -verbose:class -jar C:\Users\alexa\AppData\Local\Temp\surefire2405688146490858653\surefirebooter4985087880621361102.jar C:\Users\alexa\AppData\Local\Temp\surefire2405688146490858653 2021-07-05T07-34-52_138-jvmRun1 surefire6407547456865244099tmp surefire_09695795624160661675tmp                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
   "C:\Program Files\Java\jdk-16\bin\java.exe"        -Dfile.encoding=UTF-8      -classpath "C:\Program Files\Java\apache-maven-3.6.3\bin\..\boot\plexus-classworlds-2.6.0.jar"   "-Dclassworlds.conf=C:\Program Files\Java\apache-maven-3.6.3\bin\..\bin\m2.conf"   "-Dmaven.home=C:\Program Files\Java\apache-maven-3.6.3\bin\.."   "-Dlibrary.jansi.path=C:\Program Files\Java\apache-maven-3.6.3\bin\..\lib\jansi-native"   "-Dmaven.multiModuleProjectDirectory=C:\Users\alexa\Documents\java-src\maven-surefire\surefire-its\target\Surefire1881IT_testJavaAgent"   org.codehaus.plexus.classworlds.launcher.Launcher -e --batch-mode -Dmaven.repo.local=C:\Users\alexa\.m2\repository org.apache.maven.plugins:maven-clean-plugin:clean -Dsurefire.version=3.0.0-M6-SNAPSHOT -Djacoco.agent=-javaagent:C:\\Users\\alexa\\.m2\\repository\\org\\jacoco\\org.jacoco.agent\\0.8.7\\org.jacoco.agent-0.8.7-runtime.jar=destfile=C:\\Users\\alexa\\Documents\\java-src\\maven-surefire\\surefire-its\\target\\jacoco-it.exec,include
 s=**/failsafe/*:**/failsafe/**/*:**/surefire/*:**/surefire/**/*,excludes=**/HelpMojo.class:**/shadefire/**/*:org/jacoco/**/*:com/vladium/emma/rt/* -Dhttps.protocols=TLSv1,TLSv1.1,TLSv1.2 -nsu verify
   "C:\Program Files\Java\jdk-16\bin\java"  -javaagent:C:\Users\alexa\Documents\java-src\maven-surefire\surefire-its\target\Surefire1881IT_testJavaAgent\target/surefire-1881-java-agent-1.0-SNAPSHOT.jar -jar C:\Users\alexa\AppData\Local\Temp\surefire1253544507142731543\surefirebooter12628764455616323129.jar C:\Users\alexa\AppData\Local\Temp\surefire1253544507142731543 2021-07-05T07-35-22_653-jvmRun1 surefire11527327993772670760tmp surefire_018188072805511397606tmp                                                                                                                                                                        
   ```
   
   The corresponding screenshot from procexp64:
   ![image](https://user-images.githubusercontent.com/1537384/124404611-d5014e00-dd65-11eb-9f81-6046c93431a2.png)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org