Skip to content

LinkageCheckerMain fails to check beam-sdks-java-extensions-sql-zetasql #1087

Closed

Description

@suztomo
suztomo-macbookpro44:beam suztomo$ ./gradlew -Ppublishing -PjavaLinkageArtifactIds=beam-sdks-java-extensions-sql-zetasql :checkJavaLinkage 
Configuration on demand is an incubating feature.

> Task :runners:apex:buildDependencyTree
See the report at: file:///Users/suztomo/beam/runners/apex/build/classes/java/main/org/apache/beam/runners/apex/dependency-tree

> Task :checkJavaLinkage
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Jan 03, 2020 10:23:32 PM com.google.cloud.tools.opensource.dependencies.DependencyGraphBuilder levelOrder
SEVERE: Infinite recursion resolving jaxen:jaxen:jar:1.1-beta-4 (compile). Likely cycle in [org.apache.beam:beam-sdks-java-extensions-sql-zetasql:jar:2.19.0-SNAPSHOT (compile), org.apache.beam:beam-sdks-java-extensions-sql:jar:2.19.0-SNAPSHOT (compile), com.alibaba:fastjson:jar:1.2.49 (compile), org.springframework:spring-webmvc:jar:4.3.7.RELEASE (provided?), org.codehaus.groovy:groovy-all:jar:2.4.9 (compile?), com.thoughtworks.xstream:xstream:jar:1.4.7 (compile?), dom4j:dom4j:jar:1.6.1 (compile?), jaxen:jaxen:jar:1.1-beta-6 (compile?), dom4j:dom4j:jar:1.5.2 (compile), jaxen:jaxen:jar:1.1-beta-4 (compile), dom4j:dom4j:jar:1.5.2 (compile)]

...

org.apache.beam:beam-sdks-java-extensions-sql-zetasql:jar:2.19.0-SNAPSHOT (compile)
 / org.apache.beam:beam-sdks-java-extensions-sql:jar:2.19.0-SNAPSHOT (compile)
 / org.apache.beam:beam-sdks-java-io-parquet:jar:2.19.0-SNAPSHOT (provided)
 / org.apache.parquet:parquet-avro:jar:1.10.0 (compile)
 / org.apache.parquet:parquet-hadoop:jar:1.10.0 (compile)
 / org.apache.hadoop:hadoop-client:jar:2.7.3 (provided)
 / org.apache.hadoop:hadoop-mapreduce-client-jobclient:jar:2.7.3 (compile)
 / org.apache.hadoop:hadoop-mapreduce-client-shuffle:jar:2.7.3 (compile)
 / org.apache.hadoop:hadoop-mapreduce-client-common:jar:2.7.3 (compile)
 / org.apache.hadoop:hadoop-yarn-server-common:jar:2.7.3 (compile)
 / org.apache.hadoop:hadoop-yarn-common:jar:2.7.3 (compile)
 / org.apache.hadoop:hadoop-yarn-api:jar:2.7.3 (compile)
 / org.apache.hadoop:hadoop-common:jar:2.7.3 (provided)
 / org.apache.hadoop:hadoop-auth:jar:2.7.3 (compile)
 / org.apache.directory.server:apacheds-kerberos-codec:jar:2.0.0-M15 (compile)
 / net.sf.ehcache:ehcache-core:jar:2.4.4 (compile)
 / org.hibernate:hibernate-core:jar:3.5.1-Final (provided)
 / org.jboss.javaee:jboss-jacc-api_JDK4:jar:1.1.0 (provided)
 / org.jboss.javaee:jboss-servlet-api_3.0:jar:1.0-SNAPSHOT (compile)
  : org.eclipse.aether.resolution.DependencyResolutionException:
     Could not find artifact org.jboss.javaee:jboss-servlet-api_3.0:jar:1.0-SNAPSHOT in central (http://repo1.maven.org/maven2/)

        at com.google.cloud.tools.opensource.dependencies.DependencyGraphBuilder.levelOrder(DependencyGraphBuilder.java:341)
        at com.google.cloud.tools.opensource.dependencies.DependencyGraphBuilder.getStaticLinkageCheckDependencyGraph(DependencyGraphBuilder.java:192)
        at com.google.cloud.tools.opensource.classpath.ClassPathBuilder.artifactsToDependencyPaths(ClassPathBuilder.java:86)
        at com.google.cloud.tools.opensource.classpath.ClassPathBuilder.artifactsToClasspath(ClassPathBuilder.java:56)
        at com.google.cloud.tools.opensource.classpath.LinkageCheckerArguments.getInputClasspath(LinkageCheckerArguments.java:187)
        at com.google.cloud.tools.opensource.classpath.LinkageCheckerMain.main(LinkageCheckerMain.java:50)

> Task :checkJavaLinkage FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':checkJavaLinkage'.
> Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_221.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.2.1/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 14m 30s
885 actionable tasks: 156 executed, 729 up-to-date

Any artifact that has hadoop-client fails with this problem. Failure at beam-sdks-java-extensions-sql-datacatalog:

org.apache.beam:beam-sdks-java-extensions-sql-datacatalog:jar:2.19.0-SNAPSHOT (compile) / org.apache.beam:beam-sdks-java-extensions-sql:jar:2.19.0-SNAPSHOT (provided) / org.apache.beam:beam-sdks-java-io-parquet:jar:2.19.0-SNAPSHOT (provided) / org.apache.parquet:parquet-avro:jar:1.10.0 (compile) / org.apache.parquet:parquet-hadoop:jar:1.10.0 (compile) / org.apache.hadoop:hadoop-client:jar:2.7.3 (provided) / org.apache.hadoop:hadoop-mapreduce-client-jobclient:jar:2.7.3 (compile) / org.apache.hadoop:hadoop-mapreduce-client-shuffle:jar:2.7.3 (compile) / org.apache.hadoop:hadoop-mapreduce-client-common:jar:2.7.3 (compile) / org.apache.hadoop:hadoop-yarn-server-common:jar:2.7.3 (compile) / org.apache.hadoop:hadoop-yarn-common:jar:2.7.3 (compile) / org.apache.hadoop:hadoop-yarn-api:jar:2.7.3 (compile) / org.apache.hadoop:hadoop-common:jar:2.7.3 (provided) / org.apache.hadoop:hadoop-auth:jar:2.7.3 (compile) / org.apache.directory.server:apacheds-kerberos-codec:jar:2.0.0-M15 (compile) / net.sf.ehcache:ehcache-core:jar:2.4.4 (compile) / org.hibernate:hibernate-core:jar:3.5.1-Final (provided) / org.jboss.javaee:jboss-jacc-api_JDK4:jar:1.1.0 (provided) / org.jboss.javaee:jboss-servlet-api_3.0:jar:1.0-SNAPSHOT (compile): org.eclipse.aether.resolution.DependencyResolutionException: Could not find artifact org.jboss.javaee:jboss-servlet-api_3.0:jar:1.0-SNAPSHOT in central (http://repo1.maven.org/maven2/)

        at com.google.cloud.tools.opensource.dependencies.DependencyGraphBuilder.levelOrder(DependencyGraphBuilder.java:341)
        at com.google.cloud.tools.opensource.dependencies.DependencyGraphBuilder.getStaticLinkageCheckDependencyGraph(DependencyGraphBuilder.java:192)
        at com.google.cloud.tools.opensource.classpath.ClassPathBuilder.artifactsToDependencyPaths(ClassPathBuilder.java:86)
        at com.google.cloud.tools.opensource.classpath.ClassPathBuilder.artifactsToClasspath(ClassPathBuilder.java:56)
        at com.google.cloud.tools.opensource.classpath.LinkageCheckerArguments.getInputClasspath(LinkageCheckerArguments.java:187)
        at com.google.cloud.tools.opensource.classpath.LinkageCheckerMain.main(LinkageCheckerMain.java:50)

Activity

  1. lukecwik commented on Jan 6, 2020

    @lukecwik

    It is odd that your getting 1.0-SNAPSHOT in your dependency resolution.

  2. suztomo commented on Jan 6, 2020

    @suztomo
    ContributorAuthor

    org.jboss.javaee:jboss-jacc-api_JDK4:1.1.0 has org.jboss.javaee:jboss-servlet-api_3.0:1.0-SNAPSHOT.

    Linkage Checker tries to resolve the dependencies of each dependency recursively. It does not stop at "provided" or "optional" dependency. This helps to find as many dependency problems as possible. The unresolvable artifact error seems genuine:

    image

    On the other hand, this missing dependency seems irrelevant to Beam. I'll think about how to enhance the tool to avoid this problem.

  3. suztomo commented on Jan 6, 2020

    @suztomo
    ContributorAuthor

    @elharo I think it's time to consider "Supplemental Class Path" (go/jdd-supplemental-classpath) as an option to run Linakge Checker. What do you think?

    Note: "--report-only-reachable" does not help, because the DependencyResolutionException occurs at building a class path. (Linkage Checker has not read any class files yet)

  4. lukecwik commented on Jan 6, 2020

    @lukecwik

    Adding an option to include provided/optional dependencies would be useful since you would want to validate that the provided/optional dependencies provide the classes that were expected.

    Also excluding certain artifacts would be useful because some classes may contain metadata about classes (e.g. osgi bundle metadata).

  5. suztomo commented on Jan 7, 2020

    @suztomo
    ContributorAuthor

    an option to include provided/optional dependencies

    @lukecwik Do you want to supply some Maven coordinates for LinkageCheckerMain? Or let it search for ones automatically? For example, do you want

    • --provide-dependencies rg.jboss.javaee:jboss-servlet-api_3.0:jar:1.0,org.apache.hadoop:hadoop-client:jar:2.7.3, or
    • --auto-add-provided-and-optional-dependencies (this imaginary option name is intentionally long)

    osgi bundle metadata

    I'm not familiar with that term. (Google gave https://blog.osgi.org/2013/01/get-help-adding-osgi-metadata-to-your.html ) Would you be willing to explain how Apache Beam uses it?

  6. lukecwik commented on Jan 7, 2020

    @lukecwik

    For Apache Beam, --auto-add-provided-and-optional-dependencies would be more useful if you also add --exclude-dependencies rg.jboss.javaee:jboss-servlet-api_3.0:jar:1.0,org.apache.hadoop:hadoop-client:jar:2.7.3 since it could be that we provide two optional dependencies that both supply the same functionality and ask the user to choose one.

    Other users could have value in --provide-dependencies.

    Apache Beam doesn't provide an OSGi bundle but some of its libraries contain the metadata and the linkage checker attempts to find the OSGi metadata classes even though they are only used by an OSGi capable runtime. I know to ignore them when the linkage checker complains about them. If I remember which one complained, I'll try to get a repro for you.

  7. suztomo commented on Jan 7, 2020

    @suztomo
    ContributorAuthor

    org.jboss.javaee:jboss-servlet-api_3.0:jar:1.0-SNAPSHOT (compile) could be in Maven snapshot repository.

  8. suztomo commented on Jan 8, 2020

    @suztomo
    ContributorAuthor

    Another idea: an option to specify artifacts which LinkageChecker does not follow when traversing dependency graph. Using example above "--no-follow org.apache.parquet:parquet-hadoop:jar:1.10.0" (parquet-hadoop is 5th item in the dependency path)

  9. suztomo commented on Jan 13, 2020

    @suztomo
    ContributorAuthor

    Note for myself: test case

    
    
      @Test
      public void testGetDirectDependencies_beamZetaSql() throws RepositoryException {
        Artifact beamZetaSql =
            new DefaultArtifact("org.apache.beam:beam-sdks-java-extensions-sql-zetasql:2.17.0");
    
        DependencyGraph dependencyGraph =
            dependencyGraphBuilder.getStaticLinkageCheckDependencyGraph(ImmutableList.of(beamZetaSql));
    
        ImmutableList<UnresolvableArtifactProblem> problems =
            dependencyGraphBuilder.getArtifactProblems();
        for (UnresolvableArtifactProblem problem : problems) {
          Truth.assertThat(problem.toString()).doesNotContain("jboss-servlet-api_3.0");
        }
      }
    
    
  10. suztomo commented on Jan 24, 2020

    @suztomo
    ContributorAuthor

    osgi bundle

    I found this today while developing enhancement showing dependency paths.

    A=beam-sdks-java-io-hadoop-format; ./gradlew -Ppublishing -PjavaLinkageArtifactIds=$A :checkJavaLinkage 
    ...
    
    (weld-osgi-bundle-1.1.0.Final.jar) com.google.common.collect.AbstractMultimap$MultisetView's method entryIterator() is not implemented in the class;
      referenced by 1 class file
        com.google.common.collect.AbstractMultiset (guava-11.0.2.jar)
    
    ...
    
    weld-osgi-bundle-1.1.0.Final.jar is at:
      org.apache.beam:beam-sdks-java-io-hadoop-format:2.20.0-SNAPSHOT (compile) / org.apache.hadoop:hadoop-common:2.8.5 (provided) / com.sun.jersey:jersey-server:1.9 (compile) / org.jboss.weld:weld-osgi-bundle:1.1.0.Final (provided)
      and other 151 dependency paths.
    

    https://gist.github.com/suztomo/92c42ffdd8e7f6a02500b53ee5dc8d9b

  11. elharo commented on Jan 24, 2020

    @elharo
    Contributor

    Guava 11? shaking my head...

  12. elharo commented on Jan 24, 2020

    @elharo
    Contributor

    com.sun.jersey:jersey-server:1.9 is also very old. Try upgrading that.

  13. suztomo commented on Jan 24, 2020

    @suztomo
    ContributorAuthor

    FYI, jersey-server and guava 11 are from Hadoop:

    guava-11.0.2.jar is at:
      org.apache.beam:beam-sdks-java-io-hadoop-format:2.20.0-SNAPSHOT (compile) / org.apache.hadoop:hadoop-common:2.8.5 (provided) / com.google.guava:guava:11.0.2 (compile)
      and 194 other dependency paths.
    

    Hadoop 3 has newer version of Guava. This is Beam's ticket to upgrade to Hadoop 3: https://issues.apache.org/jira/browse/BEAM-8569

  14. lukecwik commented on Jan 29, 2020

    @lukecwik

    Released libraries are for forever.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions