7 Replies Latest reply on Jun 8, 2012 10:14 AM by alain_defrance

    Many byteman run in the same device

    alain_defrance

      Hi,

       

      I going to explain what I did and what is my usecase with byteman.

      Actually I'm using byteman to count how many SQL queries are executed during an unit test. Since my test suite is executed by jenkins, I have many concurrent builds and sometimes the testsuite is failing with :

      java.net.ConnectException: Connection refused

      at java.net.PlainSocketImpl.socketConnect(Native Method)

      at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351)

      at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213)

      at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200)

      at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)

      at java.net.Socket.connect(Socket.java:529)

      at java.net.Socket.connect(Socket.java:478)

      at java.net.Socket.<init>(Socket.java:375)

      at java.net.Socket.<init>(Socket.java:189)

      at org.jboss.byteman.agent.submit.Submit$Comm.<init>(Submit.java:797)

      at org.jboss.byteman.agent.submit.Submit.submitRequest(Submit.java:735)

      at org.jboss.byteman.agent.submit.Submit.addScripts(Submit.java:574)

      at org.jboss.byteman.agent.submit.Submit.addRulesFromFiles(Submit.java:547)

      at org.jboss.byteman.contrib.bmunit.BMUnit.loadScriptFile(BMUnit.java:295)

       

      I thought that I could have a port conflict during agent installing and I definied a random port (filling "org.jboss.byteman.contrib.bmunit.agent.port" system property) to prevent port conflicts.

       

      But this didn't solve my issue and after a deeper investigation, I found this constructor : https://github.com/bytemanproject/byteman/blob/master/install/src/main/java/org/jboss/byteman/agent/install/Install.java#L162

      Actually the port attribute seem unused and the port is always definied to 0 (I guess default).

       

      Thus I wonder if my configuration is really considered or not and how could I fix my issue.

      Please, can someone help me with this issue ?

       

      Regards,

      Alain.

        • 1. Re: Many byteman run in the same device
          alain_defrance

          I've just modified this part locally and bmunit too because bmunit didn't consider host and port at script submit.

          On my local build all seems ok and I can push it and do a pull request if you need this fix.

           

          Edit : you can reach the commit there : https://github.com/defrancea/byteman/commit/7cbe70ed23e75ecb70c099891eaed46505ccd7a8

          I can do a Pull Request if you need to integrate it.

           

          Regards,

          Alain.

          • 2. Re: Many byteman run in the same device
            adinn

            Hi Alain,

            Alain Defrance wrote:

             

            I've just modified this part locally and bmunit too because bmunit didn't consider host and port at script submit.

            On my local build all seems ok and I can push it and do a pull request if you need this fix.

             

            Edit : you can reach the commit there : https://github.com/defrancea/byteman/commit/7cbe70ed23e75ecb70c099891eaed46505ccd7a8

            I can do a Pull Request if you need to integrate it.

             

            Well done for spotting this and for fixing it and testing the fix. Thank you very much. I will raise a JIRA for this with you as reporter and ensure the fix is in the next release.

             

            There is no need for a pull request -- I will push the patch from my build to the master repo. I would prefer to modify your patch slightly so that the BMUnit nethods host() and port() return a port and hostname which are  cached at agent load time. That will avoid repeating the getProperty() and valueOf() calls.

            • 3. Re: Many byteman run in the same device
              alain_defrance

              Hi Andrew,

               

              Thank you for your reply.

               

              I did the changes you would and did a commit --amend && push --force. You can reach the new commit there : https://github.com/defrancea/byteman/commit/25d2a8b23ad8b6644ed74e90b71f058b0ed7b226

              Now getters lazy load system properties. If these properties were not set the lookup will not be cached (with this implementation). I could handle this case if you want using a flag value, but I guess it's enough.

               

              Good to hear this bug will be fixed in the next release, had you a planned date for byteman 2.0.4 ?

              • 4. Re: Many byteman run in the same device
                adinn

                HI Alain,

                 

                This has now been fixed

                 

                  https://issues.jboss.org/browse/BYTEMAN-208

                 

                I modified your solution slightly so that it only checks the System property once when class BMUNit is initialised at class load time. This also ensures that the values used at agent load are always the saem as those used for sybmit operations.

                 

                 

                Alain Defrance wrote:

                 

                Good to hear this bug will be fixed in the next release, had you a planned date for byteman 2.0.4 ?

                 

                The next release I had planned is 2.1.0. I am hoping to add a few new features before releasing anything new:

                 

                    automatically casting down in assignments where the target is a subtype of the assigned value

                    supporting imports of modules when the runtime is using a module-based loader (e.g. JBoss modules, Jigsaw, OSGi)

                    make it easier to deploy and link rule code and helper code via a module based loader

                 

                However, I am not sure when I will have time to do any of this. So, I may well end up making 2.1.0 a simple patch release and pushing it out in a couple of months when enough bugs and  fixes have accumulated. If you have a pressing need for a new release with this fix I could maybe consider a patch release sooner.

                • 5. Re: Many byteman run in the same device
                  alain_defrance

                  Actually this bug is very disturbing for us because it produces some false positive test failure on our jenkins.

                  If you do a patch release, we will able to have a clean jenkins more quickly.

                   

                  But since I can correctly build and test my project locally, that's not critical.

                  • 6. Re: Many byteman run in the same device
                    adinn

                    Ok, Alain, I just pushed out a micro-patch release 2.0.4 whih cincludes the fix for your bug. You can access it form the downloads page or maven central. Enjoy :-)

                    • 7. Re: Many byteman run in the same device
                      alain_defrance

                      Thank you Andrew.

                       

                      I'll wait for this version be replicated on maven central.