glassfish
  1. glassfish
  2. GLASSFISH-17262

Reconfiguration on unpooling causes NullPointerException

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 4.0
    • Fix Version/s: 3.1.2_b13, 4.0
    • Component/s: jdbc
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

      Description

      When increasing steady-pool-size dynamically after getting connections from unpooling JDBC connection pool, ConnectorRuntimeException occurred because of NullPointerException on creating a new connection. Unpooling JDBC connection pool should not be affected by steady-pool-size because the container must not have any pooled connections. I think the problem is that UnpooledResource.reconfigurePool() just delegates ConnectionPool.reconfigurePool().

      [Reproducible steps]
      1. asadmin set resources.jdbc-connection-pool.DerbyPool.pooling=false
      2. asadmin set resources.jdbc-connection-pool.DerbyPool.steady-pool-size=8
      3. Getting connections using DerbyPool.
      4. asadmin set resources.jdbc-connection-pool.DerbyPool.steady-pool-size=9

      [server.log]
      [#|2011-08-31T15:31:07.060+1000|SEVERE|glassfish3.2|LogStrings.org.glassfish.resources|_ThreadID=43;_ThreadName=Thread-2;|resources.resource-manager.change-event-failed
      com.sun.appserv.connectors.internal.api.ConnectorRuntimeException
      at com.sun.enterprise.connectors.service.ConnectorConnectionPoolAdminServiceImpl.updateMCFAndPoolAttributes(ConnectorConnectionPoolAdminServiceImpl.java:1275)
      at com.sun.enterprise.connectors.service.ConnectorConnectionPoolAdminServiceImpl.reconfigureConnectorConnectionPool(ConnectorConnectionPoolAdminServiceImpl.java:1221)
      at com.sun.enterprise.connectors.ConnectorRuntime.reconfigureConnectorConnectionPool(ConnectorRuntime.java:878)
      at com.sun.enterprise.resource.deployer.JdbcConnectionPoolDeployer.redeployResource(JdbcConnectionPoolDeployer.java:784)
      at org.glassfish.resources.ResourceManager$PropertyChangeHandler.handleChangeEvent(ResourceManager.java:382)
      at org.glassfish.resources.ResourceManager$PropertyChangeHandler.changed(ResourceManager.java:332)
      at org.jvnet.hk2.config.ConfigSupport.sortAndDispatch(ConfigSupport.java:332)
      at org.glassfish.resources.ResourceManager.changed(ResourceManager.java:277)
      at org.jvnet.hk2.config.Transactions$ConfigListenerJob.process(Transactions.java:400)
      at org.jvnet.hk2.config.Transactions$ConfigListenerJob.process(Transactions.java:390)
      at org.jvnet.hk2.config.Transactions$ConfigListenerNotifier$1$1.call(Transactions.java:280)
      at org.jvnet.hk2.config.Transactions$ConfigListenerNotifier$1$1.call(Transactions.java:278)
      at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
      at java.util.concurrent.FutureTask.run(FutureTask.java:138)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
      at java.lang.Thread.run(Thread.java:662)

      #]

      [StackTrace when NullPointerException occurs]
      UnpooledResource(ConnectionPool).createSingleResource(ResourceAllocator) line: 907
      UnpooledResource(ConnectionPool).createResource(ResourceAllocator) line: 1185
      RWLockDataStructure.addResource(ResourceAllocator, int) line: 98
      UnpooledResource(ConnectionPool).addResource(ResourceAllocator) line: 282
      UnpooledResource(ConnectionPool).createResourceAndAddToPool(ResourceAllocator) line: 1501
      UnpooledResource(ConnectionPool).increaseSteadyPoolSize(int) line: 1491
      UnpooledResource(ConnectionPool).reconfigurePool(ConnectorConnectionPool) line: 1425
      PoolManagerImpl.reconfigPoolProperties(ConnectorConnectionPool) line: 674
      ConnectorConnectionPoolAdminServiceImpl.updateMCFAndPoolAttributes(ConnectorConnectionPool) line: 1273
      ConnectorConnectionPoolAdminServiceImpl.reconfigureConnectorConnectionPool(ConnectorConnectionPool, Set) line: 1221
      ConnectorRuntime.reconfigureConnectorConnectionPool(ConnectorConnectionPool, Set) line: 878
      JdbcConnectionPoolDeployer.redeployResource(Object) line: 784
      ResourceManager$PropertyChangeHandler.handleChangeEvent(T) line: 382
      ResourceManager$PropertyChangeHandler.changed(TYPE, Class<T>, T) line: 332

      [line:907 of ConnectionPool]
      protected ResourceHandle createSingleResource(ResourceAllocator resourceAllocator) throws PoolingException {
      ...
      resourceHandle = resourceAllocator.createResource();//L907: resourceAllocator is null when UnpooledResource.reconfigurePool() is called.
      ...
      }

      I tested using GFv3.2(r48897).

        Activity

        Hide
        ito_m added a comment -

        The attached zip file is a reproducible application.

        1. unzip the attached zip file to trunk\v2\appserv-tests\devtests directory
        2. cd trunk\v2\appserv-tests\devtests\issues\GF17262
        3. asadmin start-domain
        4. asadmin start-database
        5. ant prepare
        6. ant run-unpool
        7. check server.log of DAS.

        Show
        ito_m added a comment - The attached zip file is a reproducible application. 1. unzip the attached zip file to trunk\v2\appserv-tests\devtests directory 2. cd trunk\v2\appserv-tests\devtests\issues\GF17262 3. asadmin start-domain 4. asadmin start-database 5. ant prepare 6. ant run-unpool 7. check server.log of DAS.
        Hide
        Shalini added a comment -

        Fixed in trunk.

        Sending appserver/connectors/connectors-runtime/src/main/java/com/sun/enterprise/resource/pool/ConnectionPool.java
        Sending appserver/connectors/connectors-runtime/src/main/java/com/sun/enterprise/resource/pool/UnpooledResource.java
        Transmitting file data ..
        Committed revision 51293.

        Show
        Shalini added a comment - Fixed in trunk. Sending appserver/connectors/connectors-runtime/src/main/java/com/sun/enterprise/resource/pool/ConnectionPool.java Sending appserver/connectors/connectors-runtime/src/main/java/com/sun/enterprise/resource/pool/UnpooledResource.java Transmitting file data .. Committed revision 51293.
        Hide
        Shalini added a comment -

        Fixed in 3.1.2.

        Sending connectors/connectors-runtime/src/main/java/com/sun/enterprise/resource/pool/ConnectionPool.java
        Sending connectors/connectors-runtime/src/main/java/com/sun/enterprise/resource/pool/UnpooledResource.java
        Transmitting file data ..
        Committed revision 51297.

        Show
        Shalini added a comment - Fixed in 3.1.2. Sending connectors/connectors-runtime/src/main/java/com/sun/enterprise/resource/pool/ConnectionPool.java Sending connectors/connectors-runtime/src/main/java/com/sun/enterprise/resource/pool/UnpooledResource.java Transmitting file data .. Committed revision 51297.

          People

          • Assignee:
            Shalini
            Reporter:
            ito_m
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: