Uploaded image for project: 'ServiceMix'
  1. ServiceMix
  2. SM-1161

jbi-service-unit causes infinite loop when dependency graph is not cycle-free

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Critical
    • Resolution: Fixed
    • 3.2, 3.2.1
    • 3.2.2, 3.3
    • tooling
    • None
    • mvn 2.0.6, win xp pro

    • Patch Available

    Description

      Hi,

      when building a JSR181 SU, maven dies in a StackOverflowException, caused by an infinite loop in AbstractJBIMojo.getArtifacts(). My guess is that one of the used libraries draws some
      transitive dependencies, which have have a cycle.

      [ERROR] FATAL ERROR
      [INFO] ------------------------------------------------------------------------
      [INFO] null
      [INFO] ------------------------------------------------------------------------
      [INFO] Trace
      java.lang.StackOverflowError
      at org.apache.maven.artifact.DefaultArtifact.hashCode(DefaultArtifact.java:305)
      at java.util.HashMap.put(HashMap.java:372)
      at java.util.HashSet.add(HashSet.java:200)
      at org.apache.servicemix.maven.plugin.jbi.AbstractJbiMojo.getArtifacts(AbstractJbiMojo.java:
      144)
      at org.apache.servicemix.maven.plugin.jbi.AbstractJbiMojo.getArtifacts(AbstractJbiMojo.java:
      147)
      at org.apache.servicemix.maven.plugin.jbi.AbstractJbiMojo.getArtifacts(AbstractJbiMojo.java:
      147)
      at org.apache.servicemix.maven.plugin.jbi.AbstractJbiMojo.getArtifacts(AbstractJbiMojo.java:
      147)
      ...

      I had a look at the code and are wondering whether the exit condition of the recursive getArtifacts() methods should also check if the artifact has already been processed.
      The same applies to the debug method "print".

      Please find attached a patch against SM 3.2.1 which fixes that (unless I did not get the original intention of getArtifacts() wrong).

      Thanks,
      Tammo

      Attachments

        1. infinite-loop-patch.txt
          2 kB
          Tammo van Lessen

        Activity

          People

            bsnyder Bruce Snyder
            vanto Tammo van Lessen
            Votes:
            1 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: