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 edge case or
      * accidentally the problem gets re-introduced in the future by someone 
else's change or refactoring.
   
   This IT (like all tests) 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
   
   So the fact that I used a GUI tool from SysInternals disqualifies me as a 
developer? It proves what? That you are a real developer and I am not? Can you 
be any more condescending?
   
   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` command only 
shows a subset of the same information, because the fact is missing that it is 
not just Java processes but a group of 4 processes per test case. 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 SysInternals `procexp64` when running 
Maven from Git Bash:
   
![image](https://user-images.githubusercontent.com/1537384/124404611-d5014e00-dd65-11eb-9f81-6046c93431a2.png)
   
   **Update:** When running from cmd.exe, there are only two processes left per 
test timed out method, not 4:
   
![image](https://user-images.githubusercontent.com/1537384/124415267-b78cae00-dd7e-11eb-812a-83a7661e10d2.png)
   
   The difference between both shells seems to originate from the fact that Git 
Bash forks a cmd.exe when running Maven, so there is more stuff to clean up. 
Why Maven in one case (cmd.exe) can terminate the parent Java process and just 
not the child, but in the other case (Git Bash) cannot terminate either of 
them, is to be investigated.


-- 
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-unsubscr...@maven.apache.org

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


Reply via email to