[ 
https://jira.codehaus.org/browse/SUREFIRE-1132?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=360846#comment-360846
 ] 

Alexander Ashitkin commented on SUREFIRE-1132:
----------------------------------------------

I was able to log classloader config and provider properties at the  moment of 
failure. As i understan junit.jar was not present in the classloader:
{code}
13:40:42 Classloader: sun.misc.Launcher$AppClassLoader@5c647e05 parent: 
sun.misc.Launcher$ExtClassLoader@3e3abc88
13:40:42 
file:/D:/.m2/repository/org/apache/maven/surefire/surefire-booter/2.19-SNAPSHOT/surefire-booter-2.19-SNAPSHOT.jar
 f:true d:false r:true
13:40:42 
file:/D:/.m2/repository/org/apache/maven/surefire/surefire-api/2.19-SNAPSHOT/surefire-api-2.19-SNAPSHOT.jar
 f:true d:false r:true
13:40:42 
file:/D:/jenkins/work/workspace/sf-2.18.1-test/blotter/my-server/server/target/test-classes/
 f:false d:true r:true
13:40:42 
file:/D:/jenkins/work/workspace/sf-2.18.1-test/blotter/my-server/server/target/classes/
 f:false d:true r:true
13:40:42 
file:/D:/.m2/repository/org/apache/maven/surefire/surefire-junit4/2.19-SNAPSHOT/surefire-junit4-2.19-SNAPSHOT.jar
 f:true d:false r:true
{code}
The data is captured as follows:
{code}
    public static SurefireProvider createProviderInCurrentClassloader( 
StartupConfiguration startupConfiguration1,
                                                                       boolean 
isInsideFork,
                                                                       
ProviderConfiguration providerConfiguration,
                                                                       Object 
reporterManagerFactory1 )
    {

        BaseProviderFactory bpf = new BaseProviderFactory( (ReporterFactory) 
reporterManagerFactory1, isInsideFork );
        bpf.setTestRequest( providerConfiguration.getTestSuiteDefinition() );
        bpf.setReporterConfiguration( 
providerConfiguration.getReporterConfiguration() );
        ClassLoader clasLoader = Thread.currentThread().getContextClassLoader();
        bpf.setClassLoaders( clasLoader );
        bpf.setTestArtifactInfo( providerConfiguration.getTestArtifact() );
        bpf.setProviderProperties( 
providerConfiguration.getProviderProperties() );
        bpf.setRunOrderParameters( 
providerConfiguration.getRunOrderParameters() );
        bpf.setDirectoryScannerParameters( 
providerConfiguration.getDirScannerParams() );
        int reattempts = 0;
        while ( reattempts < 3 )
        {
            try
            {
                return ( SurefireProvider ) ReflectionUtils.instantiateOneArg( 
clasLoader,
                                                                             
startupConfiguration1.getActualClassName(),
                                                                             
ProviderParameters.class, bpf );
            }
            catch ( Throwable e )
            {
                reattempts++;
                System.err.println( Thread.currentThread().getName()
                        + ": Error creating provider with configuration: " + 
providerConfiguration );
                e.printStackTrace();
                System.err.println( "Classloader: " + clasLoader + " parent: " 
+ clasLoader.getParent() );
                if ( clasLoader instanceof URLClassLoader )
                {
                    final URLClassLoader ucl = (URLClassLoader) clasLoader;
                    final URL[] urls = ucl.getURLs();
                    for ( URL url : urls )
                    {
                        try
                        {
                            final URI uri = url.toURI();
                            final File file = new File( uri );
                            if ( file.exists() )
                            {
                                System.err.println( url + "f:" + file.isFile()
                                        + " d:" + file.isDirectory() + " r:" + 
file.canRead() );
                            }
                        }
                        catch ( URISyntaxException e1 )
                        {
                            System.err.println( "Error converting url: " + url 
);
                            e1.printStackTrace();
                        }
                    }
                }
                try
                {
                    System.err.println( "Sleeping before reattempt" );
                    Thread.sleep( MILLIS );
                }
                catch ( InterruptedException e1 )
                {
                    e1.printStackTrace();
                    Thread.currentThread().interrupt();
                }
            }
        }
        throw new RuntimeException( "Failed to create provider" );
    }

{code}
thats all i see. No artifact dependencies, only compiled code and surefire apis 
in classpaths. Is it something expected and i need to look something else?

thank you

> Surefire: regular isolated classloader failures in parallelbuild
> ----------------------------------------------------------------
>
>                 Key: SUREFIRE-1132
>                 URL: https://jira.codehaus.org/browse/SUREFIRE-1132
>             Project: Maven Surefire
>          Issue Type: Bug
>          Components: classloading
>    Affects Versions: 2.17, 2.18.1
>         Environment: SLES 3.0.80-0.7-default SMP x86_64 GNU/Linux
> windows server 2008 x64
> Maven 3.2.2, 3.2.3, 3.2.5
> Oracle HotSpot JDK 7u25/7u65/8u25
>            Reporter: Alexander Ashitkin
>         Attachments: consoleText-1.txt, consoleText-2.txt, consoleText-3.txt
>
>
> We have a large project of 300+ modules which regularly fails with different 
> kind of classloading issues in different places in surefire plugin. The issue 
> is reproduced only with parallel build and is not reproduced in single 
> threaded. This is a main contributor in build instability for us. All the not 
> loaded dependnecies are actually present in dependency tree. I attached 3 
> different samples of how build fails.
> Surefire config:
> {code}
>                     <configuration>
>                         <forkCount>0</forkCount>
>                         <!--doesnt work in parrallel build. Causes build 
> failures with error java.io.IOException: Stream Closed-->                     
>  <redirectTestOutputToFile>false</redirectTestOutputToFile>
>                         <useManifestOnlyJar>false</useManifestOnlyJar>
>                     </configuration>
> {code}
> maven cmd is like install -T 10
>  Please advise how to sort this out - ready to run any provided diagnostic 
> and evaluate any options.
> Thanks in advance, Alexander



--
This message was sent by Atlassian JIRA
(v6.1.6#6162)

Reply via email to