4 Replies Latest reply on Oct 17, 2012 12:32 PM by Jeremy Whiting

    Rule condition causes VerifyError

    Jeremy Whiting Expert

      Hi,

      I am having a problem defining a bm script that has the following condition

       

      IF -1 != $e.getMessage().indexOf("timed")

       

      This is the error message

       

      $ bin/bmsubmit.sh ~/java/jboss/byteman/byteman-download-2.0.3/sample/scripts/ConnectionTimedOutStats.btm

      redefine rule Connection timed key info

      redefine rule count timed out GET connections

      VerifyError during retransformation : some rules may not have been correctly injected or uninjected!

      java.lang.VerifyError

      at sun.instrument.InstrumentationImpl.retransformClasses0(Native Method)

      at sun.instrument.InstrumentationImpl.retransformClasses(InstrumentationImpl.java:144)

      at org.jboss.byteman.agent.Retransformer.installScript(Retransformer.java:136)

      at org.jboss.byteman.agent.TransformListener.handleScripts(TransformListener.java:337)

      at org.jboss.byteman.agent.TransformListener.loadScripts(TransformListener.java:260)

      at org.jboss.byteman.agent.TransformListener.handleConnection(TransformListener.java:213)

      at org.jboss.byteman.agent.TransformListener.run(TransformListener.java:146)

       

      Replacing the condition line with

       

      IF TRUE

       

      causes the rule to load without error. Though it does not do what I need.

       

       

      Is there something wrong with this condition ? I am expecting to check the presence of the text "timed" in an exception message. The e reference is in scope.

       

      Regards,

      Jeremy

        • 1. Re: Rule condition causes VerifyError
          Andrew Dinn Master

          Hi Jeremy,

          Jeremy Whiting wrote:

           

          I am having a problem defining a bm script that has the following condition

           

          IF -1 != $e.getMessage().indexOf("timed")

           

          . . .

           

           

          Is there something wrong with this condition ? I am expecting to check the presence of the text "timed" in an exception message. The e reference is in scope.

           

          I am not quite sure why this passes the type checker but does not pass  the verifier. It may be a bug in the type checker or it may be something  much more subtle. I'll need to take a proper look at this in order to work out what the verify error is. Can you provide me with either the code and rule script which is manifesting the problem or a reproducer for the bug based on a simpler program/script?

          • 2. Re: Rule condition causes VerifyError
            Jeremy Whiting Expert

            Hi Andrew,

            I tried creating a reproducer but the message is different. Instead there are two warning messages. Shall I start another forum discussion for the different topic and continue on here when that is solved ?

             

            Regards,

            Jeremy

            • 3. Re: Rule condition causes VerifyError
              Andrew Dinn Master

              Hi Jeremy

              Jeremy Whiting wrote:

               

              Hi Andrew,

              I tried creating a reproducer but the message is different. Instead there are two warning messages. Shall I start another forum discussion for the different topic and continue on here when that is solved ?

               

              Yes, please start another thread. Meanwhiel I guess I'll ned to see your code for this problem.

              • 4. Re: Rule condition causes VerifyError
                Jeremy Whiting Expert

                Hi,

                Now the warning messages have been resolved the reproducer does not generate the VerifyError. I will need to investigate further why. This is the java application and the byteman script used to replicate the boolean rule condition that was causing the VerifyError in the  original application. When using bmsubmit.sh

                 

                 

                package org.jboss.perf;

                 

                import java.lang.Exception;

                 

                public class TimedOutExceptionThrower

                {

                   public static void main(String args[])

                   {

                      while (true)

                      {// this will never stop, you do need to terminate the process

                         try

                         {

                            throw new Exception("connection timed out");

                         }

                         catch (Exception e)

                         {

                            System.out.println("An exceptional situation ocurred.");

                         }

                      }

                   }

                }

                 

                ########################################################################

                #

                # Print a debug message when the cause has "timed" in the message text

                #

                 

                HELPER org.jboss.byteman.sample.helper.JMXHelper

                 

                RULE Connection timed key info

                CLASS org.jboss.byteman.sample.helper.JMXHelper

                METHOD keyInfo()

                BIND keyInfo : KeyInfo = new KeyInfo("recreate issue")

                IF TRUE

                DO

                   keyInfo.addKey("timed out", KeyInfo.KEY_TYPE_CUMULATIVE, "timed out");

                RETURN keyInfo

                ENDRULE

                 

                 

                RULE debug cause of exception

                CLASS org.jboss.perf.TimedOutExceptionThrower

                METHOD main

                AT LINE 17

                IF -1 != $e.getMessage().indexOf("timed")

                DO

                   incrementCounter("timed out")

                ENDRULE

                 

                Regards,

                Jeremy