3 Replies Latest reply on Jun 4, 2014 12:59 PM by Jean-Louis Pasturel

    Dynamic submission : pb when re-submitting new byteman rule

    Jean-Louis Pasturel Newbie

      All operations described below are done without stopping the JVM.

      Tested with JVM HotSpot 1.6 and 1.7 and JBOSS 7.2, I  set correctly the param : 

      JBOSS_MODULES_SYSTEM_PKGS="org.jboss.byteman,jlp.byteman.helper,jlp.byteman.helper.specific"

       

      1 ) I install the agent with bminstall on a JVM => operation OK

      2 ) I submit a sys jar containing all my custom helpers ( bmsubmit -s  pathToMyJarHelpers ...)

      3 ) I submit a script file with rules that trigger SimpleDAO.getData() ( ENTRY + EXIT) => submit OK

      4) I test the application => OK the rules are correctly triggered

      5 ) I unsubmit this file script rule=> unsubmit OK => no trigger when testing

      6) I submit the same script file rules and test => submit and trigger OK

      7) i unsubmit the script

      8) I submit a new script rule that trigger a method nested in SimpleDAO.getData() ( DBCP JDBC pool) => submit OK

      9) When I  test, I got an error =>  Rule.execute called for org.apache.commons.dbcp.BasicDataSource write 26_14

      15:26:06,437 INFO  [stdout] (http-/10.170.192.236:8080-1) Rule.ensureTypeCheckedCompiled : error type checking rule org.apache.commons.dbcp.BasicDataSource

       

      Nota: When i restart the JVM and submitting directly the second script rule, it runs correctly ( the script is OK)

       

      Is-it a JVM bug when retransforming  class / method?

       


        • 1. Re: Dynamic submission : pb when re-submitting new byteman rule
          Jean-Louis Pasturel Newbie

          humm ! I think i am in the case of the JVM bug related in the documentation : page 48 of the  Programmer guide case 2 of submit pasted below.

          I have continued the test with re-submitting the first rule, and the first rule is correctly submitted and triggered.

           

           

          n.b. Due to a bug in Sun's JDK 6 and 7 and in OpenJDK 6 and 7 errors may occur when

           

          installing a script in case 2 above (where an uploaded rule is applied to an already loaded

           

          class which has not yet been transformed). Scripts which employ references to local

           

          variables or method parameters by name will fail to compile. These JDKs retain the

           

          original bytecode for classes which are successfully transformed. However, where classes

           

          are not transformed the bytecode is discarded. When a retransform is requested the JVM's

           

          in-memory represenation of the class (a C++ klass instance) is used to reconstitute the

           

          bytecode. Unfortunately the current reconstitute code does not recreate the local variable

           

          tables which were in the originally loaded bytecode. There is an OpenJDK bugzilla

           

          (#100100) and fix for this problem but the fix has not yet been incorporated into a release.

          • 2. Re: Re: Dynamic submission : pb when re-submitting new byteman rule
            Andrew Dinn Master

            Hi Jean-Loius,

            humm ! I think i am in the case of the JVM bug related in the documentation : page 48 of the  Programmer guide case 2 of submit pasted below.

            That bug was fixed in OpenJDK8 about 6-9 months ago. I believe the patch has also been back-ported to recent OpenJDK7 releases. So, maybe you should retry on a recent OpenJDK7.

            • 3. Re: Dynamic submission : pb when re-submitting new byteman rule
              Jean-Louis Pasturel Newbie

              I have back in this forum, and i tested a re-submit of a new rule wkith :
              open-jdk 1.7.0_55 and Oracle JDK 1.7.0_60@ and it runs as expected with no error.
              I have not tried with older version.

              I see that the recent Byteman programmerGuide is up to date for this issue.