ServiceMix
  1. ServiceMix
  2. SM-1161

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

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 3.2, 3.2.1
    • Fix Version/s: 3.2.2, 3.3
    • Component/s: tooling
    • Labels:
      None
    • Environment:

      mvn 2.0.6, win xp pro

    • Patch Info:
      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

        Activity

        Jeff Turner made changes -
        Project Import Sat Nov 27 00:46:19 EST 2010 [ 1290836779991 ]
        Bruce Snyder made changes -
        Fix Version/s 3.2.2 [ 11861 ]
        Fix Version/s 3.3 [ 11850 ]
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Hide
        Bruce Snyder added a comment -

        Committed to the 3.2 branch via revision 634707 and to the trunk (3.3) via revision 634714.

        Show
        Bruce Snyder added a comment - Committed to the 3.2 branch via revision 634707 and to the trunk (3.3) via revision 634714 .
        Bruce Snyder committed 634714 (1 file)
        Reviews: none

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

        Bruce Snyder committed 634707 (1 file)
        Bruce Snyder made changes -
        Assignee Bruce Snyder [ bsnyder ]
        Tammo van Lessen made changes -
        Field Original Value New Value
        Attachment infinite-loop-patch.txt [ 15945 ]
        Hide
        Tammo van Lessen added a comment -

        da patch

        Show
        Tammo van Lessen added a comment - da patch
        Tammo van Lessen created issue -

          People

          • Assignee:
            Bruce Snyder
            Reporter:
            Tammo van Lessen
          • Votes:
            1 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development