3 Replies Latest reply on Sep 15, 2017 8:35 AM by ion_mayank

    IdleRemover thread in Wildfly is removing ResourceAdapter connection

    ion_mayank

      I am facing an issue with Resource Adapter connection. ResourceAdaptor is deploying perfectly however after 45 mins IdleRemover is destroying the connection automatically.

      In my application I do not want IdleRemover to remove my ResourceAdaptor connection therefore I tried to configure minimum number of connections to be 5 but even with this IdleRemover is removing all the Idle connections. So, it looks it is ignoring the min-connection-pool configuration.

       

      Attaching my resource adapter configuration:

       

                      <resource-adapter id="myEAR.ear#rarFile.rar">

                          <archive>

                              myEAR.ear#rarFile.rar

                          </archive>

                          <transaction-support>NoTransaction</transaction-support>

                          <connection-definitions>

                              <connection-definition class-name="com.connector.myresourceadapter.MyManagedConnectionFactory" jndi-name="java:/eis/MyResourceAdapter" enabled="true" use-java-context="true" pool-name="MyResourceAdapter" use-ccm="true">

                                  <pool>

                                      <min-pool-size>5</min-pool-size>

                                      <prefill>false</prefill>

                                      <use-strict-min>false</use-strict-min>

                                      <flush-strategy>FailingConnectionOnly</flush-strategy>

                                  </pool>

                                  <security>

                                      <application/>

                                  </security>

                                  <validation>

                                      <background-validation>false</background-validation>

                                      <use-fast-fail>false</use-fast-fail>

                                  </validation>

                              </connection-definition>

                          </connection-definitions>

                      </resource-adapter>

       

      Is there a way to stop IdleRemover from removing ResourceAdapter Connection?

      Any help is appreciated.

       

      Thanks.

       

      Adding a statistics for resource adapter which shows the configuration at runtime. As you can see min-connection-pool is '10', active-count is '5' and idle-count is also '5'. But when the IdleScanner runs it removes all the connections despite min-connection-pool is set to '10'.

        • 1. Re: IdleRemover thread in Wildfly is removing ResourceAdapter connection
          andey

          1# Need to configure "idle-timeout-minutes": The idle-timeout-minutes elements indicates the maximum time in minutes a connection may be idle before being closed. The actual maximum time depends also on the IdleRemover scan time, which is 1/2 the smallest idle-timeout-minutes of any pool.

           

          This is idle connection exist time, JBoss default is 30 minutes . You need to specify as per your application requirement.

           

          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

                        <timeout>

                           <idle-timeout-minutes>30</idle-timeout-minutes>  "JBoss default is 30 minutes"

                             ....

                         </timeout>

          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

           

          2# Set prefill to "true" so that the connections are created at startup.

           

          3#  You should enabled *use-fast-fail = true* (immediately get a new physical connection)

           

          use-fast-fail determines whether or not to continue to attempt to acquire a connection from the pool even if the nth attempt has failed. If false, JBoss will move onto the next connection in the pool after "allocation-retry" has been reached. If true, JBoss will assume that all connections in the pool are invalid after the first connection exceeds the "allocation-retry".

           

           

          • 2. Re: IdleRemover thread in Wildfly is removing ResourceAdapter connection
            ion_mayank

            1# On my machine default "idle-timeout-minutes" is automatically set to 45 minutes as I can see that my connections are getting cleaned in 45 minutes automatically. However I do NOT want to clean my connection automatically by IdleRemover. I have a polling job running which is associated to that connection. It may be that I do not have anything to read on that connection for more than 45 minutes does not mean I want to clear those connection. What configuration I can do that IdleScanner do not scan my particular resource adapter pool and I will myself close the connection when I actually what to do that.

             

            2# Would prefill stop the idleRemover Thread from cleaning the Idle Connections? I think even with PreFill IdleRemover will remove Idle Connections which I do not want.

             

            3# As I said in point 1. my polling job has an associated Resource Adapter connection. If IdleRemover destroys/cleans the connection my polling job is also instructed to stop. Therefore, use-fast-fail flag will not resolve my issue as I would need to restart the polling job as well after acquiring a new connection.

             

            So, is there a way in wildfly to stop IdleRemover from scanning Resource Adapter connections or some configuration where Idle Timeout is never reached.

            Also, even if I am configuring min-connection-pool to '10' why wildfly server is removing the idle connections? Is this is some kind of a bug in Ironjacamar?

             

            NOTE: I have migrated the application from Jboss AS 6 server to Wildfly 10.1. IdleRemover on Jboss AS 6 was not removing the connection and the problem is only happening on Wildfly server.

            • 3. Re: IdleRemover thread in Wildfly is removing ResourceAdapter connection
              ion_mayank

              Update: Got it working.

               

              To stop IdleRemover from cleaning up the Idle connections we need to configure timeout with '0' in resource-adapter subsystem configuration.

               

              <timeout>

                <idle-timeout-minutes>0</idle-timeout-minutes>

              </timeout>