STAMP-project / botsing

Botsing is a Java framework for crash reproduction. It depends on EvoSuite (http://www.evosuite.org) for code instrumentation.
https://stamp-project.github.io/botsing
Apache License 2.0
32 stars 17 forks source link

Problem with the class loader when calling static class initialisation method #61

Open xdevroey opened 5 years ago

xdevroey commented 5 years ago

Running botsing-1.0.3 with ./dependencies containing all the jars of authzforce + all the deps I could get with maven dependency plugin:

java -jar /home/gibello/.m2/repository/eu/stamp-project/botsing-reproduction/1.0.3/botsing-reproduction-1.0.3.jar -crash_log /tmp/ex1.log -target_frame 4 -project_cp ./dependencies/

Produces the following error without stopping the execution:

09:28:06.718 [main] INFO  e.s.b.reproduction.CrashReproduction - Starting the dependency analysis. The number of detected jar files is 119.
Exception in thread "main" java.util.ServiceConfigurationError: org.ow2.authzforce.core.pdp.api.PdpExtension: Provider org.ow2.authzforce.core.pdp.testutil.ext.TestAttributeProvider$Factory not a subtype
    at java.util.ServiceLoader.fail(ServiceLoader.java:239)
    at java.util.ServiceLoader.access$300(ServiceLoader.java:185)
    at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:376)
    at java.util.ServiceLoader$LazyIterator.access$700(ServiceLoader.java:323)
    at java.util.ServiceLoader$LazyIterator$2.run(ServiceLoader.java:407)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:409)
    at java.util.ServiceLoader$1.next(ServiceLoader.java:480)
    at org.ow2.authzforce.core.pdp.impl.PdpExtensions.<clinit>(PdpExtensions.java)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:348)
    at org.evosuite.setup.TestClusterUtils.getClass(TestClusterUtils.java:312)
    at org.evosuite.setup.TestClusterGenerator.initializeTargetMethods(TestClusterGenerator.java:663)
    at org.evosuite.setup.TestClusterGenerator.generateCluster(TestClusterGenerator.java:134)
    at org.evosuite.setup.DependencyAnalysis.analyze(DependencyAnalysis.java:118)
    at org.evosuite.setup.DependencyAnalysis.analyzeClass(DependencyAnalysis.java:132)
    at eu.stamp.botsing.reproduction.CrashReproduction.initializeTargetClass(CrashReproduction.java:200)
    at eu.stamp.botsing.reproduction.CrashReproduction.generateCrashReproductionTests(CrashReproduction.java:103)
    at eu.stamp.botsing.reproduction.CrashReproduction.execute(CrashReproduction.java:78)
    at eu.stamp.botsing.Botsing.parseCommandLine(Botsing.java:68)
    at eu.stamp.botsing.Botsing.main(Botsing.java:161)

Originally posted by @gibello in https://github.com/STAMP-project/botsing/issues/58#issuecomment-473199957

xdevroey commented 5 years ago

Stack trace for botsing-reproduction is:

java.lang.RuntimeException: Failed to load XML schemas: [classpath:pdp.xsd]
    at org.ow2.authzforce.core.pdp.impl.SchemaHandler.createSchema(SchemaHandler.java:541)
    at org.ow2.authzforce.core.pdp.impl.PdpModelHandler.<init>(PdpModelHandler.java:159)
    at org.ow2.authzforce.core.pdp.impl.PdpEngineConfiguration.getInstance(PdpEngineConfiguration.java:682)
    at org.ow2.authzforce.core.pdp.impl.PdpEngineConfiguration.getInstance(PdpEngineConfiguration.java:699)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162)
xdevroey commented 5 years ago

Class org.ow2.authzforce.core.pdp.impl.PdpExtensions has a user defined static class initialiser. EvoSuite class loader seems unnable to load the class (?).

gibello commented 5 years ago

Tried with target_frame 1: works fine with the 1.0.3 command line (at least, generates a test). But the 1.0.4-SNAPSHOT maven plugin does not seem to work: it does not seem to support multimodule projects ?

mvn eu.stamp-project:botsing-maven:1.0.4-SNAPSHOT:botsing -Dcrash_log=/tmp/ex1.log -Dtarget_frame=1

If run in authzforce/core, an error occurs: INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 3.250 s [INFO] Finished at: 2019-03-15T16:21:57+01:00 [INFO] Final Memory: 16M/208M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal eu.stamp-project:botsing-maven:1.0.4-SNAPSHOT:botsing (default-cli) on project authzforce-ce-core: Error executing Botsing: Classpath element does not exist on disk at: /home/gibello/STAMP/STAMP-project/authzforce/core/target/classes -> [Help 1]

If run inside modules directories (I tried them all), there is no error, but an empty test is generated. I never obtain a test, like with the command line.