Doing some simple stress testing, I really think my database connection isn't 
being closed.  I am using EJB3. I'm not sure what version, an early RC version 
probably and jboss 4.0.3.

My servlet code is:

  |     UserTransaction ut = null;
  |         try {
  |             // begin transaction
  |             InitialContext ctx = new InitialContext();
  |           
  |             ut = (UserTransaction)ctx.lookup("java:comp/UserTransaction");
  |             ut.begin();
  |             
  |     ... do webpage code
  | 
  |             ut.commit();
  |             
  |         catch (Exception e) {
  |             log.error("error in servlet", e);
  |             try {
  |                 ut.rollback();
  |             }
  |             catch (Exception erb) {
  |                 log.error("could not rollback transaction", erb);
  |             }
  |             
  |         }
  |         finally {
  |             
  |             ut = null;
  |         }
  | 

Postrgres is setup to accept 20 connections. My datasource is setup for 10 
connections max. I am using JMeter to do the stress testing. I setup JMeter to 
run 10 threads concurrently and load a series of webpages. Soon after I start 
the test, I get the error:


  | 10:59:45,341 WARN  
[org.jboss.resource.connectionmanager.JBossManagedConnectionPool:232] Throwable 
while attempting to get a new connection: null
  | org.jboss.resource.JBossResourceException: Could not create connection; - 
nested throwable: (org.postgresql.util.PSQLException: FATAL: sorry, too many 
clients already)
  |     at 
org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.java:164)
  |     at 
org.jboss.resource.connectionmanager.InternalManagedConnectionPool.createConnectionEventListener(InternalManagedConnectionPool.java:519)
  |     at 
org.jboss.resource.connectionmanager.InternalManagedConnectionPool.getConnection(InternalManagedConnectionPool.java:208)
  |     at 
org.jboss.resource.connectionmanager.JBossManagedConnectionPool$BasePool.getConnection(JBossManagedConnectionPool.java:566)
  |     at 
org.jboss.resource.connectionmanager.BaseConnectionManager2.getManagedConnection(BaseConnectionManager2.java:410)
  |     at 
org.jboss.resource.connectionmanager.TxConnectionManager.getManagedConnection(TxConnectionManager.java:342)
  |     at 
org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:462)
  | 
  | 

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4035379#4035379

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4035379
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to