Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-28781

bytecode-compatibility-transformer produces malformed bytecode

      In the case where we see this issue, an @AdaptField annotation on Queue.Item was causing transformations in other classes not intended for transformation (in our case, in an elasticsearch class). The result of this transformation was a StackMapFrame verifier error.

      this issue tracks the tracks:

        • bytecode-compatibility-transformer doesn't properly support updating of StackMapFrames after manipulation.

          [JENKINS-28781] bytecode-compatibility-transformer produces malformed bytecode

          Tom FENNELLY created issue -
          Tom FENNELLY made changes -
          Description Original: In the case where we see this issue, an [@AdaptField annotation on Queue.Item|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/model/Queue.java#L1753-L1762] was causing a transformation in a different class (in our case, in an elasticsearch class). The result of this transformation was a StackMapFrame verifier error.

          So there may actually be 2 or 3 bugs that need to be spun out from this:

          # The bytecode transformer is transforming methods/fields that it should not be transforming.
          # And one or both of the following:
          #* Jenkins core use of the bytecode transformer is not specifying to update StackMapFrame after transformations/rewrites.
          #* bytecode transformer is not performing StackMapFrame updates after transformations/rewrites.
          New: In the case where we see this issue, an [@AdaptField annotation on Queue.Item|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/model/Queue.java#L1753-L1762] was causing transformations in other classes not intended for transformation (in our case, in an elasticsearch class). The result of this transformation was a StackMapFrame verifier error.

          So there may actually be 2 or 3 bugs that need to be spun out from this:

          # The bytecode transformer is transforming methods/fields that it should not be transforming.
          # And one or both of the following:
          #* Jenkins core use of the bytecode transformer is not specifying to update StackMapFrame after transformations/rewrites.
          #* bytecode transformer is not performing StackMapFrame updates after transformations/rewrites.
          Tom FENNELLY made changes -
          Description Original: In the case where we see this issue, an [@AdaptField annotation on Queue.Item|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/model/Queue.java#L1753-L1762] was causing transformations in other classes not intended for transformation (in our case, in an elasticsearch class). The result of this transformation was a StackMapFrame verifier error.

          So there may actually be 2 or 3 bugs that need to be spun out from this:

          # The bytecode transformer is transforming methods/fields that it should not be transforming.
          # And one or both of the following:
          #* Jenkins core use of the bytecode transformer is not specifying to update StackMapFrame after transformations/rewrites.
          #* bytecode transformer is not performing StackMapFrame updates after transformations/rewrites.
          New: In the case where we see this issue, an [@AdaptField annotation on Queue.Item|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/model/Queue.java#L1753-L1762] was causing transformations in other classes not intended for transformation (in our case, in an elasticsearch class). The result of this transformation was a StackMapFrame verifier error.

          So there may actually be 2 or 3 bugs that need to be spun out from this:

          # The bytecode transformer is transforming methods/fields that it should not be transforming.
          # And one or both of the following:
          #* bytecode-compatibility-transformer doesn't support updating of StackMapFrames after manipulation.
          #* bytecode-compatibility-transformer does support updating of StackMapFrames after manipulation, but Jenkins core is not using that properly.

          It does look as though bytecode-compatibility-transformer has some support for StackMapFrames.
          Tom FENNELLY made changes -
          Description Original: In the case where we see this issue, an [@AdaptField annotation on Queue.Item|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/model/Queue.java#L1753-L1762] was causing transformations in other classes not intended for transformation (in our case, in an elasticsearch class). The result of this transformation was a StackMapFrame verifier error.

          So there may actually be 2 or 3 bugs that need to be spun out from this:

          # The bytecode transformer is transforming methods/fields that it should not be transforming.
          # And one or both of the following:
          #* bytecode-compatibility-transformer doesn't support updating of StackMapFrames after manipulation.
          #* bytecode-compatibility-transformer does support updating of StackMapFrames after manipulation, but Jenkins core is not using that properly.

          It does look as though bytecode-compatibility-transformer has some support for StackMapFrames.
          New: In the case where we see this issue, an [@AdaptField annotation on Queue.Item|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/model/Queue.java#L1753-L1762] was causing transformations in other classes not intended for transformation (in our case, in an elasticsearch class). The result of this transformation was a StackMapFrame verifier error.

          So there may actually be 2 or 3 bugs that need to be spun out from this:

          # The bytecode transformer is transforming methods/fields that it should not be transforming.
          # And one or both of the following:
          #* bytecode-compatibility-transformer doesn't properly support updating of StackMapFrames after manipulation.
          #* bytecode-compatibility-transformer does support updating of StackMapFrames after manipulation, but Jenkins core is not using that properly.

          It does look as though bytecode-compatibility-transformer has some support for StackMapFrames.
          James Nord made changes -
          Assignee Original: Kohsuke Kawaguchi [ kohsuke ] New: James Nord [ teilo ]

          James Nord added a comment -

          There are 2 issues that are seemingly at play here.

          1) the affected class does not use any of the Jenkins API and should not have been transformed.
          2) the transformer is producing a class that is broken.

          James Nord added a comment - There are 2 issues that are seemingly at play here. 1) the affected class does not use any of the Jenkins API and should not have been transformed. 2) the transformer is producing a class that is broken.
          Jesse Glick made changes -
          Link New: This issue is related to JENKINS-19383 [ JENKINS-19383 ]

          Tom FENNELLY added a comment -

          Root cause seems to be the same as with JENKINS-19383 i.e. rewriting methods/fields that should not be rewritten.

          Tom FENNELLY added a comment - Root cause seems to be the same as with JENKINS-19383 i.e. rewriting methods/fields that should not be rewritten.

          James Nord added a comment -

          unfortunately the binaries for this are not available (unreleased version).

          Caused by: java.lang.VerifyError: Expecting a stackmap frame at branch target 20
          Exception Details:
            Location:
              org/elasticsearch/common/settings/ImmutableSettings$Builder.get(Ljava/lang/String;)Ljava/lang/String; @15: ifnull
            Reason:
              Expected stackmap frame at this location.
            Bytecode:
              0x0000000: 2ab4 002a 2bb9 003a 0200 c000 354d 2cc6
              0x0000010: 0005 2cb0 2ab4 002a 2bb8 003f b900 3a02
              0x0000020: 00c0 0035 b0
          
                  at org.elasticsearch.common.settings.ImmutableSettings.<clinit>(ImmutableSettings.java:57)
                  at com.cloudbees.opscenter.elasticsearch.embedded.EmbeddedNode.start(EmbeddedNode.java:94)
          

          James Nord added a comment - unfortunately the binaries for this are not available (unreleased version). Caused by: java.lang.VerifyError: Expecting a stackmap frame at branch target 20 Exception Details: Location: org/elasticsearch/common/settings/ImmutableSettings$Builder.get(Ljava/lang/String;)Ljava/lang/String; @15: ifnull Reason: Expected stackmap frame at this location. Bytecode: 0x0000000: 2ab4 002a 2bb9 003a 0200 c000 354d 2cc6 0x0000010: 0005 2cb0 2ab4 002a 2bb8 003f b900 3a02 0x0000020: 00c0 0035 b0 at org.elasticsearch.common.settings.ImmutableSettings.<clinit>(ImmutableSettings.java:57) at com.cloudbees.opscenter.elasticsearch.embedded.EmbeddedNode.start(EmbeddedNode.java:94)

          James Nord added a comment -

          James Nord added a comment - https://github.com/jenkinsci/bytecode-compatibility-transformer/pull/2

            Unassigned Unassigned
            tfennelly Tom FENNELLY
            Votes:
            2 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated:
              Resolved: