Geronimo
  1. Geronimo
  2. GERONIMO-4993

Requests for db pool resources will exceed Max Pool Size when EJBNetworkService beans are all busy

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.1.3, 2.2
    • Fix Version/s: 2.1.5
    • Component/s: None
    • Security Level: public (Regular issues)
    • Labels:
      None
    • Environment:

      Linux and Windows XP

      Description

      In production, I have 100 EJBNetworkService threads. It works OK until there's a spike in traffic and all the threads are being used, and the 40 "max pool size" is ignored, and Geronimo makes 100's of DB connections.

      In production, I am using an Oracle DB pool, so the DBAs aren't happy when my servers use up all the available server connections.

      To recreate:

      1. Change config.xml and start Geronimo:
      <module name="org.apache.geronimo.configs/openejb/2.2-SNAPSHOT/car">
      <gbean name="EJBNetworkService">
      <attribute name="port">$

      {OpenEJBPort + PortOffset}

      </attribute>
      <attribute name="host">$

      {ServerHostname}

      </attribute>
      <attribute name="multicastHost">$

      {MulticastDiscoveryAddress}

      </attribute>
      <attribute name="multicastPort">$

      {MulticastDiscoveryPort}

      </attribute>
      <attribute name="clusterName">$

      {ClusterName}

      </attribute>
      <attribute name="threads">5</attribute>
      </gbean>

      2. Reconfigure the jdbc/ArchiveDS DB Pool:
      Max Pool Size: 3
      Blocking Timeout: 1000
      Idle Timeout: 1

      3. Install WAR
      4. In web browser, go to http://localhost:8080/PoolTest/PoolTest. Reload it 5 times. Take your time It should be fine, and will give you an error when the pool is maxed.
      5. In JMX Viewer, go to Geronimo MBeans, JCAConnectionManager, and pull up jdbc/ArchiveDS. Note the connection count. Looks good.
      6. Wait for the connection count to return to 0.
      7. In your browser, hold down F5 so the page reloads many times.
      8. Observe the connection count again. It will be over connections.
      9. If you repeat 6-9 you can easily get > 20 connections. I just held F5 for 6 seconds and there are 60 connections.

      I will attach WAR (I don't see an option on this screen).

      1. screenshot-1.jpg
        696 kB
        Eric Phetteplace
      2. _PoolTest.war
        4 kB
        Eric Phetteplace

        Issue Links

          Activity

          Hide
          Eric Phetteplace added a comment -

          Simple WAR:

          public void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException
          {
          DataSource ds = null;
          Connection con = null;

          InitialContext ctx = null;
          try

          { ctx = new InitialContext(); ds = (DataSource) ctx .lookup("java:comp/env/jdbc/ArchiveDS"); con = ds.getConnection(); Thread.sleep(30000); }

          catch (Exception e)

          { logger.error(e.getMessage()); throw new ServletException(e.getMessage()); }

          finally{
          if(ctx!=null) try

          {ctx.close();}

          catch(Exception ex){}
          con=null;
          }

          }

          Show
          Eric Phetteplace added a comment - Simple WAR: public void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException { DataSource ds = null; Connection con = null; InitialContext ctx = null; try { ctx = new InitialContext(); ds = (DataSource) ctx .lookup("java:comp/env/jdbc/ArchiveDS"); con = ds.getConnection(); Thread.sleep(30000); } catch (Exception e) { logger.error(e.getMessage()); throw new ServletException(e.getMessage()); } finally{ if(ctx!=null) try {ctx.close();} catch(Exception ex){} con=null; } }
          Hide
          Eric Phetteplace added a comment -

          ConnectionCount is 61 even though partitionMaxSize is 3

          Show
          Eric Phetteplace added a comment - ConnectionCount is 61 even though partitionMaxSize is 3
          Hide
          David Jencks added a comment -

          I don't think the ejb threads have anything to do with this problem, since the pool test war doesn't use ejbs. I've identified and fixed the problems demonstrated by the pool test war in GERONIMO-5150. Please see if this fixes the problems you are seeing in the actual app.

          Show
          David Jencks added a comment - I don't think the ejb threads have anything to do with this problem, since the pool test war doesn't use ejbs. I've identified and fixed the problems demonstrated by the pool test war in GERONIMO-5150 . Please see if this fixes the problems you are seeing in the actual app.
          Hide
          Eric Phetteplace added a comment -

          It still happens in the 2.1.5 snapshot at http://people.apache.org/builds/geronimo/server/binaries/2.1/20100215/geronimo-tomcat6-javaee5-2.1.5-SNAPSHOT-bin.zip

          I repeated the steps above and got up to 12 threads (>3max) in three minutes.

          Show
          Eric Phetteplace added a comment - It still happens in the 2.1.5 snapshot at http://people.apache.org/builds/geronimo/server/binaries/2.1/20100215/geronimo-tomcat6-javaee5-2.1.5-SNAPSHOT-bin.zip I repeated the steps above and got up to 12 threads (>3max) in three minutes.
          Hide
          David Jencks added a comment -

          Unfortunately that build was made before the fix, so it would definitely illustrate the problem
          We're working on getting a snapshot build out that includes the fix or if you are in a bigger hurry you can try building the 2.1 branch yourself....

          Show
          David Jencks added a comment - Unfortunately that build was made before the fix, so it would definitely illustrate the problem We're working on getting a snapshot build out that includes the fix or if you are in a bigger hurry you can try building the 2.1 branch yourself....
          Hide
          Eric Phetteplace added a comment -

          I pulled the 2.1 branch. Indeed it is fixed!

          Thanks so much!

          Show
          Eric Phetteplace added a comment - I pulled the 2.1 branch. Indeed it is fixed! Thanks so much!
          Hide
          Lu Jiang added a comment -

          I have verified this JIRA using the latest build (GERONIMO 2.1.5 SNAPSHOT,2010.3.11),it works fine.The permitted Connection will be limited within the max pool size.
          So this JIRA can be closed now

          Show
          Lu Jiang added a comment - I have verified this JIRA using the latest build (GERONIMO 2.1.5 SNAPSHOT,2010.3.11),it works fine.The permitted Connection will be limited within the max pool size. So this JIRA can be closed now
          Hide
          Rex Wang added a comment -

          Close pre above comments, thanks Lu.

          Show
          Rex Wang added a comment - Close pre above comments, thanks Lu.

            People

            • Assignee:
              David Jencks
              Reporter:
              Eric Phetteplace
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development