9 Replies Latest reply on Dec 13, 2012 1:22 PM by mandrosen

    possible bad side effects from change to AbstractConnectionManager

    mandrosen

      After migrating from jboss4 to jboss7 (currently jboss-as-7.1.1Final), we started seeing the error 'Unable to get managed connection' during certain high load periods using the same size pool that we were using in jboss4.  I put more details in this discussion: https://community.jboss.org/thread/214179

       

      It seemed that there should still have been available connections while we got this error because MySQL showed the connections as sleeping.  I was looking at the code where the error is being thrown org.jboss.jca.core.connectionmanager.AbstractConnectionManager (ironjacamar-core-impl-1.0.9.Final.jar) at line 329.   I added one call that seems to help a little with our application, but I'm unsure if the benefits outweigh any negative side effects.

       

      After line 333, failure = e; I added a pool flush.  Here is the diff:

       

      334a335,336

      >          pool.flush(true);

      >

       

      The flush seems to release the connection that wasn't sleeping so it can be used again.

       

       

      Is there a better way to accomplish this?

        • 1. Re: possible bad side effects from change to AbstractConnectionManager
          jesper.pedersen

          First of all - you should be using a nightly snapshot.

           

          Then look into the <validation> element and provide the plugins needed (MySQL), and do <flush-strategy>IdleConnections</flush-strategy>

           

          If you still have errors after that I would need to see TRACE log from org.jboss.jca and your full configuration.

          • 2. Re: possible bad side effects from change to AbstractConnectionManager
            mandrosen

            I will test it with the nightly snapshot, but I have been using the validation plugins and the flush strategy.  I'll let you know what happens with the snapshot.

            • 3. Re: possible bad side effects from change to AbstractConnectionManager
              mandrosen

              I am going to test with 1.0.13.Final, 1.1.0.Beta3, and then if those don't work, I can try the head version (is there a repository with nightly builds or should I just build it myself). 

               

              My question is which version of jboss are those built against.  When I used 1.0.13.Final, I am getting this error:

              Caused by: java.lang.ClassNotFoundException: org.jboss.jca.common.api.metadata.ds.DataSource$Tag from [Module "org.jboss.as.connector:main" from local module loader @538d7ace (roots: /usr/java/jboss/modules)]

               

              so I will update the org.jboss.as.connector module, but I want to make sure I am using the correct version.

               

              Thanks for your help.  I really appreciate it.

              • 4. Re: possible bad side effects from change to AbstractConnectionManager
                jesper.pedersen

                IronJacamar 1.1 is for EE 7.

                 

                AS7/master already contains IJ 1.0.13... so you just need the latest nightly snapshot

                • 5. Re: possible bad side effects from change to AbstractConnectionManager
                  mandrosen

                  I had the same issue with the latest jboss snapshot: jboss-as-7.2.0.Alpha1-SNAPSHOT

                   

                  The trace is attached.

                   

                  My datasource config:

                   

                                  <datasource jta="true" jndi-name="java:jboss/datasources/atDS" pool-name="MySqlDS" enabled="true" spy="true" use-ccm="true">

                                      <connection-url>jdbc:mysql://dbserv:3306/db</connection-url>

                                      <driver-class>com.mysql.jdbc.Driver</driver-class>

                                      <driver>mysql-connector-java-5.1.22-bin.jar</driver>

                                      <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>

                                      <pool>

                                          <min-pool-size>0</min-pool-size>

                                          <max-pool-size>1</max-pool-size>

                                          <prefill>true</prefill>

                                          <use-strict-min>true</use-strict-min>

                                          <flush-strategy>IdleConnections</flush-strategy>

                                      </pool>

                                      <security>

                                          <user-name>user</user-name>

                                          <password>passwd</password>

                                      </security>

                                      <validation>

                                          <valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLValidConnectionChecker"/>

                                          <stale-connection-checker class-name="org.jboss.jca.adatpers.jdbc.extensions.mysql.MySQLStaleConnectionChecker"/>

                                          <exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLExceptionSorter"/>

                                      </validation>

                                      <timeout>

                                          <allocation-retry>3</allocation-retry>

                                      </timeout>

                                  </datasource>

                  • 6. Re: possible bad side effects from change to AbstractConnectionManager
                    jesper.pedersen

                    I'm not seeing anything here. If you only have 1 connection available, then requests will timeout.

                    • 7. Re: possible bad side effects from change to AbstractConnectionManager
                      mandrosen

                      Thanks for looking into this.

                       

                      When you say the requests, are you referring to the requests for a connection?

                       

                      When mysql shows the connection as sleeping, but we still get the error, unable to retrieve managed connection, does that mean something is holding on to the connection?

                      • 8. Re: possible bad side effects from change to AbstractConnectionManager
                        jesper.pedersen

                        You have <max-pool-size> at 1 - it doesn't matter how many the connections the database is configured for.

                         

                        Your log shows that the app gives up after 30 seconds to get a connection, which is default.

                         

                        Your prefill at true doesn't do anything, since your <min-pool-size> is 0.

                         

                        http://docs.jboss.org/ironjacamar/userguide/1.0/en-US/html/deployment.html#deployingds_descriptor

                        • 9. Re: possible bad side effects from change to AbstractConnectionManager
                          mandrosen

                          Very true, the prefill is left over from other configs -- useless in this test.

                           

                          I did try increasing the blocking-timeout (default 30), but it just waits longer to timeout.

                           

                          It seems stable and working with the increased number of connections.  I am curious about that one connection, but it's ok for now.

                           

                          Thanks for your help.