You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by jsdima <gi...@git.apache.org> on 2016/12/23 12:26:07 UTC

[GitHub] maven-surefire pull request #137: Fix SUREFIRE-1239

GitHub user jsdima opened a pull request:

    https://github.com/apache/maven-surefire/pull/137

    Fix SUREFIRE-1239

    Project to reproduce - https://github.com/jsdima/SUREFIRE-1239-reproduce
    
    More info:
    Problem appears when there are a lot of console output after last test(which leads to save this output to file) in TestSet, and in the next TestSet some test fails. It happens because stream (`Utf8RecodingDeferredFileOutputStream testStdOut`)  which collects data after test execution but before TestSet finished  then also used in next TestSet.
    
    Sometimes it leads to 
    ```
    [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test (default-test) on project SUREFIRE-1239-reproduce: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test failed: java.lang.RuntimeException: org.apache.maven.surefire.report.ReporterException: When writing xml report stdout/stderr: /tmp/stdout8948920314382993444deferred (No such file or directory) -> [Help 1]
    ```
    
    sometimes build just hangs

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/jsdima/maven-surefire master

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/maven-surefire/pull/137.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #137
    
----
commit 768bd3c1bc0894269b6f6819eb643ea328d08c42
Author: dg <dg...@utgard>
Date:   2016-12-23T11:14:17Z

    Fix SUREFIRE-1239

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


[GitHub] maven-surefire issue #137: Fix SUREFIRE-1239

Posted by Tibor17 <gi...@git.apache.org>.
Github user Tibor17 commented on the issue:

    https://github.com/apache/maven-surefire/pull/137
  
    @jsdima 
    Long time I was thinking about deleting the class `ThreadedStreamConsumer`. It looks like old mechanism where data was populated from multiple `ForkStarter`s but this is no longer valid. Each method `ForkStarter#fork()` L532 already uses single Thread started by `executeCommandLineAsCallable()`. It means that `ThreadedStreamConsumer` the plugin does not benefit from the pumper and the blocking queue. WDYT?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


[GitHub] maven-surefire issue #137: Fix SUREFIRE-1239

Posted by Tibor17 <gi...@git.apache.org>.
Github user Tibor17 commented on the issue:

    https://github.com/apache/maven-surefire/pull/137
  
    @jsdima 
    Thx for contributing. Pls close this PR.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


[GitHub] maven-surefire issue #137: Fix SUREFIRE-1239

Posted by jsdima <gi...@git.apache.org>.
Github user jsdima commented on the issue:

    https://github.com/apache/maven-surefire/pull/137
  
    you are welcome



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


[GitHub] maven-surefire pull request #137: Fix SUREFIRE-1239

Posted by jsdima <gi...@git.apache.org>.
Github user jsdima closed the pull request at:

    https://github.com/apache/maven-surefire/pull/137


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


[GitHub] maven-surefire issue #137: Fix SUREFIRE-1239

Posted by jsdima <gi...@git.apache.org>.
Github user jsdima commented on the issue:

    https://github.com/apache/maven-surefire/pull/137
  
    @Tibor17 
    
    >I am interested in this problem because as you said the plugin hangs. Why the plugin hanged, do you have explanation?
    
    It depends on a size of `private final BlockingQueue<String> items` 
    in `ThreadedStreamConsumer` at the moment when Exception happens and amount of tests output .
    
    Surefire plugin has 3 important threads when running tests in separate process:
    - `StreamPumper` thread which reads input from child process and put them to `items`, it finishes when there is no more input from child process
    - `ThreadedStreamConsumer.Pumper`thread which takes line from `items` and call `ForkClient`to process it
    - `Main` thread which awaits when `StreamPumper` finishes
    
    so when exception happens `ThreadedStreamConsumer.Pumper`thread ends, but  `StreamPumper` still reads input and put in into `items`, but when size of `items` becomes bigger than `ITEM_LIMIT_BEFORE_SLEEP`, this thread starts sleep every iteration:
    
    ```java
            if ( items.size() > ITEM_LIMIT_BEFORE_SLEEP )
            {
                try
                {
                    Thread.sleep( 100 );
                }
                catch ( InterruptedException ignore )
                {
                }
            }
    ```
    
    > Did you run the build with your patch? It means mvn -P run-its install.
    
    Yes. The result:
    ```
    [INFO] ------------------------------------------------------------------------
    [INFO] Reactor Summary:
    [INFO] 
    [INFO] Apache Maven Surefire .............................. SUCCESS [ 10.423 s]
    [INFO] SureFire Logger API ................................ SUCCESS [  3.082 s]
    [INFO] ShadeFire JUnit3 Provider .......................... SUCCESS [  1.926 s]
    [INFO] SureFire API ....................................... SUCCESS [  4.787 s]
    [INFO] SureFire Booter .................................... SUCCESS [  2.016 s]
    [INFO] Maven Surefire Test-Grouping Support ............... SUCCESS [  1.859 s]
    [INFO] SureFire Providers ................................. SUCCESS [  0.650 s]
    [INFO] Shared JUnit3 Provider Code ........................ SUCCESS [  0.870 s]
    [INFO] Shared Java 5 Provider Base ........................ SUCCESS [  1.300 s]
    [INFO] Shared JUnit4 Provider Code ........................ SUCCESS [  1.164 s]
    [INFO] Shared JUnit48 Provider Code ....................... SUCCESS [  2.048 s]
    [INFO] SureFire JUnit Runner .............................. SUCCESS [  0.857 s]
    [INFO] SureFire JUnit4 Runner ............................. SUCCESS [  1.505 s]
    [INFO] Maven Surefire Common .............................. SUCCESS [  7.801 s]
    [INFO] SureFire JUnitCore Runner .......................... SUCCESS [ 51.535 s]
    [INFO] SureFire TestNG Utils .............................. SUCCESS [  1.158 s]
    [INFO] SureFire TestNG Runner ............................. SUCCESS [  1.222 s]
    [INFO] Surefire Report Parser ............................. SUCCESS [  1.460 s]
    [INFO] Maven Surefire Plugin .............................. SUCCESS [  5.049 s]
    [INFO] Maven Failsafe Plugin .............................. SUCCESS [ 47.971 s]
    [INFO] Maven Surefire Report Plugin ....................... SUCCESS [  8.128 s]
    [INFO] Maven Surefire Integration Test Setup .............. SUCCESS [  9.125 s]
    [INFO] Maven Surefire Integration Tests ................... SUCCESS [47:52 min]
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESS
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 50:39 min
    [INFO] Finished at: 2016-12-30T14:34:19+03:00
    [INFO] Final Memory: 79M/1118M
    [INFO] ------------------------------------------------------------------------
    ```
    
    > The issue [1] you pointed out happens after your fix or without it?
    
    before applying the fix


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


[GitHub] maven-surefire issue #137: Fix SUREFIRE-1239

Posted by Tibor17 <gi...@git.apache.org>.
Github user Tibor17 commented on the issue:

    https://github.com/apache/maven-surefire/pull/137
  
    @jsdima 
    I am interested in this problem because as you said the plugin hangs.  Why the plugin hanged, do you have explanation?
    Did you run the build with your patch? It means `mvn -P run-its install`.
    The issue [1] you pointed out happens after your fix or without it?
    [1] `[ERROR] Failed to execute goal...`


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


[GitHub] maven-surefire issue #137: Fix SUREFIRE-1239

Posted by Tibor17 <gi...@git.apache.org>.
Github user Tibor17 commented on the issue:

    https://github.com/apache/maven-surefire/pull/137
  
    @jsdima 
    The constructor of `BlockingQueue` takes capacity of 2xE09 which practically means no limitation.
    The only operation which can block is `queue.take()`. What call sequences may cause that the `ForkClient` hangs?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org