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

bytecode-compatibility-transformer produces malformed bytecode

    Details

    • Similar Issues:

      Description

      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.

        Attachments

          Issue Links

            Activity

            tfennelly Tom FENNELLY created issue -
            tfennelly Tom FENNELLY made changes -
            Field Original Value New Value
            Description 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.
            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.
            tfennelly Tom FENNELLY made changes -
            Description 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.
            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.
            tfennelly Tom FENNELLY made changes -
            Description 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.
            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.
            teilo James Nord made changes -
            Assignee Kohsuke Kawaguchi [ kohsuke ] James Nord [ teilo ]
            Hide
            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.

            Show
            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.
            jglick Jesse Glick made changes -
            Link This issue is related to JENKINS-19383 [ JENKINS-19383 ]
            Hide
            tfennelly 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.

            Show
            tfennelly 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.
            Hide
            teilo 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)
            
            Show
            teilo 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)
            Show
            teilo James Nord added a comment - https://github.com/jenkinsci/bytecode-compatibility-transformer/pull/2
            teilo James Nord made changes -
            Link This issue is related to JENKINS-28799 [ JENKINS-28799 ]
            teilo James Nord made changes -
            Summary bytecode-compatibility-transformer transforming methods/fields it should not be transforming bytecode-compatibility-transformer produces malformed bytecode
            teilo James Nord made changes -
            Description 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.
            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.

            this issue tracks the tracks:
            #* bytecode-compatibility-transformer doesn't properly support updating of StackMapFrames after manipulation.

            alskor Alex Java made changes -
            Link This issue is related to JENKINS-29692 [ JENKINS-29692 ]
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: James Nord
            Path:
            src/main/java/org/jenkinsci/bytecode/Transformer.java
            http://jenkins-ci.org/commit/bytecode-compatibility-transformer/33cd0196b5f7e1957534ab1d2dae4de78a1bfd5d
            Log:
            [ISSUE JENKINS-28781] Regernate the stack frames.

            We should always re-generate the stack map frames when re-writing methods.

            As the asm can not compute frames for code with subroutines we also need
            to inline any subroutines.

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: James Nord Path: src/main/java/org/jenkinsci/bytecode/Transformer.java http://jenkins-ci.org/commit/bytecode-compatibility-transformer/33cd0196b5f7e1957534ab1d2dae4de78a1bfd5d Log: [ISSUE JENKINS-28781] Regernate the stack frames. We should always re-generate the stack map frames when re-writing methods. As the asm can not compute frames for code with subroutines we also need to inline any subroutines.
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: James Nord
            Path:
            .gitignore
            src/main/java/org/jenkinsci/bytecode/Transformer.java
            http://jenkins-ci.org/commit/bytecode-compatibility-transformer/cda6033617f92a6acbe571fdb09efafdc4921dab
            Log:
            Merge pull request #2 from jtnord/JENKINS-28781-part1

            JENKINS-28781 Fix generated bytecode

            Compare: https://github.com/jenkinsci/bytecode-compatibility-transformer/compare/494273053c7c...cda6033617f9

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: James Nord Path: .gitignore src/main/java/org/jenkinsci/bytecode/Transformer.java http://jenkins-ci.org/commit/bytecode-compatibility-transformer/cda6033617f92a6acbe571fdb09efafdc4921dab Log: Merge pull request #2 from jtnord/ JENKINS-28781 -part1 JENKINS-28781 Fix generated bytecode Compare: https://github.com/jenkinsci/bytecode-compatibility-transformer/compare/494273053c7c...cda6033617f9
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: James Nord
            Path:
            core/pom.xml
            http://jenkins-ci.org/commit/jenkins/80ea8982f35119a19e2d5b36ba3cfefe125d367d
            Log:
            JENKINS-28781 update the bct library to 1.6.2.

            Pickup the changes in the bytecode-compatibility-transformer for
            JENKINS-28781

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: James Nord Path: core/pom.xml http://jenkins-ci.org/commit/jenkins/80ea8982f35119a19e2d5b36ba3cfefe125d367d Log: JENKINS-28781 update the bct library to 1.6.2. Pickup the changes in the bytecode-compatibility-transformer for JENKINS-28781
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: James Nord
            Path:
            core/pom.xml
            http://jenkins-ci.org/commit/jenkins/6af3df951fef38e89fe8d01e8b827e8164565171
            Log:
            Merge pull request #1857 from jtnord/JENKINS-28781

            JENKINS-28781 update the bct library to 1.6.2.

            Compare: https://github.com/jenkinsci/jenkins/compare/a79e2f144a93...6af3df951fef

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: James Nord Path: core/pom.xml http://jenkins-ci.org/commit/jenkins/6af3df951fef38e89fe8d01e8b827e8164565171 Log: Merge pull request #1857 from jtnord/ JENKINS-28781 JENKINS-28781 update the bct library to 1.6.2. Compare: https://github.com/jenkinsci/jenkins/compare/a79e2f144a93...6af3df951fef
            Hide
            dogfood dogfood added a comment -

            Integrated in jenkins_main_trunk #4308
            JENKINS-28781 update the bct library to 1.6.2. (Revision 80ea8982f35119a19e2d5b36ba3cfefe125d367d)

            Result = SUCCESS
            james nord : 80ea8982f35119a19e2d5b36ba3cfefe125d367d
            Files :

            • core/pom.xml
            Show
            dogfood dogfood added a comment - Integrated in jenkins_main_trunk #4308 JENKINS-28781 update the bct library to 1.6.2. (Revision 80ea8982f35119a19e2d5b36ba3cfefe125d367d) Result = SUCCESS james nord : 80ea8982f35119a19e2d5b36ba3cfefe125d367d Files : core/pom.xml
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: James Nord
            Path:
            changelog.html
            http://jenkins-ci.org/commit/jenkins/7f1ad86d646204fbda45bfcf7a7c044d0d81adce
            Log:
            Noting JENKINS-28781

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: James Nord Path: changelog.html http://jenkins-ci.org/commit/jenkins/7f1ad86d646204fbda45bfcf7a7c044d0d81adce Log: Noting JENKINS-28781
            teilo James Nord made changes -
            Link This issue is related to JENKINS-30820 [ JENKINS-30820 ]
            Hide
            teilo James Nord added a comment -

            Fixed in bytecode-compatability-transformer version 1.6.2
            integrated into Jenkins 1.633

            Show
            teilo James Nord added a comment - Fixed in bytecode-compatability-transformer version 1.6.2 integrated into Jenkins 1.633
            teilo James Nord made changes -
            Status Open [ 1 ] Closed [ 6 ]
            Resolution Fixed [ 1 ]
            jglick Jesse Glick made changes -
            Link This issue is duplicated by JENKINS-30665 [ JENKINS-30665 ]
            rtyler R. Tyler Croy made changes -
            Workflow JNJira [ 163639 ] JNJira + In-Review [ 208856 ]

              People

              • Assignee:
                teilo James Nord
                Reporter:
                tfennelly Tom FENNELLY
              • Votes:
                2 Vote for this issue
                Watchers:
                9 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: