You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Rainer Klute <kl...@rainer-klute.de> on 2004/02/14 18:32:11 UTC

ODMG: PostgreSQL database connection not closed

I use the OJB implementation of the ODMG API in a web application environment with Tomcat 5 and PostgreSQL 7.4. During development I often redeploy my application into the running Tomcat. When the servlet context is shutdown, I call org.odmg.Database.close() to close the database connection.

However, the connection is still hanging around which can be noticed by PostgreSQL's postmaster processes. (PostgreSQL has one process per database connection.) After several edit-compile-deploy cycles I have a lot of them. Only when I shutdown Tomcat the processes and the connections disappear. I suspect that org.odmg.Database.close() does not really close the database connection.

Best regards
Rainer Klute

                           Rainer Klute IT-Consulting GmbH
  Dipl.-Inform.
  Rainer Klute             E-Mail:  klute@rainer-klute.de
  Körner Grund 24          Telefon: +49 172 2324824
D-44143 Dortmund           Telefax: +49 231 5349423

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: ODMG: PostgreSQL database connection not closed

Posted by "olivier.nouguier" <ol...@wanadoo.fr>.
Hi list,
	I used to encountered the same "exhausted pool" with tomcat
redeployment. To solve this I build a:
	DevDataSourceFactory returning DevDatasource ( with a cleanPool()
method )
	A lifecycle listener who on webapp stop do walk the JNDI tree and call
"cleanPool()" on every "DevDatasource" it founds.

hih
 
Le sam 14/02/2004 à 19:11, Armin Waibel a écrit :
> Hi Rainer,
> 
> Rainer Klute wrote:
> 
> > I use the OJB implementation of the ODMG API in a web application environment with Tomcat 5 and PostgreSQL 7.4. During development I often redeploy my application into the running Tomcat. When the servlet context is shutdown, I call org.odmg.Database.close() to close the database connection.
> > 
> > However, the connection is still hanging around which can be noticed by PostgreSQL's postmaster processes. (PostgreSQL has one process per database connection.) After several edit-compile-deploy cycles I have a lot of them. Only when I shutdown Tomcat the processes and the connections disappear. I suspect that org.odmg.Database.close() does not really close the database connection.
> > 
> 
> you are right odmg.Database implementation does not close any 
> connections. By default OJB use a connection pool, thus connections will 
> never be closed by OJB (configurabale by 'ConnectionFactoryClass' in 
> OJB.properties).
> 
> For development you can try a workaround like this
> ((ConnectionManagerImpl)broker.serviceConnectionManager()).getUnderlyingConnectionFactory().releaseAllResources()
> 
> regards,
> Armin
> 
> > Best regards
> > Rainer Klute
> > 
> >                            Rainer Klute IT-Consulting GmbH
> >   Dipl.-Inform.
> >   Rainer Klute             E-Mail:  klute@rainer-klute.de
> >   Körner Grund 24          Telefon: +49 172 2324824
> > D-44143 Dortmund           Telefax: +49 231 5349423
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> > For additional commands, e-mail: ojb-user-help@db.apache.org
> > 
> > 
> > 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: ODMG: PostgreSQL database connection not closed

Posted by Armin Waibel <ar...@apache.org>.
Hi Rainer,

Rainer Klute wrote:

> I use the OJB implementation of the ODMG API in a web application environment with Tomcat 5 and PostgreSQL 7.4. During development I often redeploy my application into the running Tomcat. When the servlet context is shutdown, I call org.odmg.Database.close() to close the database connection.
> 
> However, the connection is still hanging around which can be noticed by PostgreSQL's postmaster processes. (PostgreSQL has one process per database connection.) After several edit-compile-deploy cycles I have a lot of them. Only when I shutdown Tomcat the processes and the connections disappear. I suspect that org.odmg.Database.close() does not really close the database connection.
> 

you are right odmg.Database implementation does not close any 
connections. By default OJB use a connection pool, thus connections will 
never be closed by OJB (configurabale by 'ConnectionFactoryClass' in 
OJB.properties).

For development you can try a workaround like this
((ConnectionManagerImpl)broker.serviceConnectionManager()).getUnderlyingConnectionFactory().releaseAllResources()

regards,
Armin

> Best regards
> Rainer Klute
> 
>                            Rainer Klute IT-Consulting GmbH
>   Dipl.-Inform.
>   Rainer Klute             E-Mail:  klute@rainer-klute.de
>   Körner Grund 24          Telefon: +49 172 2324824
> D-44143 Dortmund           Telefax: +49 231 5349423
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
> 
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org