Joaquin,

You really need to get a copy of those Exceptions... broken pipe on a 
web / app server typically is quite normal as it can be as simple as 
someone hitting the stop or the refresh button on their web browser 
while the server was trying to process a request.

Also it may be a consequence of the fact that your application is losing 
database connectivity... broken pages... people hitting refresh 
repeatedly... etc... .  So if this is as frequent as you state then 
simply put together some of the stack traces and send that out.

c3p0 has a number of settings that set out how many times it will retry, 
the interval it will wait between retries and / or how long it will 
retry before giving up, etc... and if IIRC some settings had to go in a 
c3p0 properties file and NOT just in the persistence.xml (in fact in the 
XML file they would be ignored).  Just google things and you should find 
some pretty useful docs... .  I imagine this is your config problem 
though this doesn't address why your connections are breaking in the 1st 
place.

BTW is there a hardware LB in the picture?  Those are notorious for 
chopping connections that remain idle for what is pretty much standard 
at around 16 seconds.  This isn't an issue under low load as connections 
simply get recycled at a high frequency... but get yourself up to 
10K-30K connections and voila log jam... the pool spends more time 
trying to create connections than it can use and you end up with 
something like 5000 TCP connections on the server.  Not fun indeed.  But 
ever so common on high end systems.

Lastly, as far as Connection Pool is concerned I have to say I have done 
a fair amount of research and am quite disappointed that either projects 
have been abandoned or not updated despite known issues...  IIRC there 
were some synchronization bugs in c3p0 that can come up... so for now we 
ended up looking at BoneCP and use that for now although I'm not sure 
how well it can recover broken connections.

Oh... and I almost forgot... 2 reasons I imagine that Connection Pooling 
projects have been more and more stale are b/c i) App Servers these days 
have built in connection pooling functionality that should be pretty 
good and ii) some consider them finished and sufficient for their 
purposes... despite the growing list of possibly "rarer" issues, RFE's, 
etc...

--Nikolaos




Joaquin Valdez wrote:
> Hello!
>
> I am wondering what the proper way of handling a database connection  
> pool when it looses connection to the database.  My application will  
> run fine for 2 weeks then it will start throwing broken pipe errors.   
> I don't have the exact error but that is what the error says.  I use a  
> postgres database and the c3po hibernate connection pool.  How do I  
> ensure connectivity is maintained?
>
> Maybe a database connection interceptor?  Just an idea.....
>
> Here is my persistence.xml file:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <persistence version="1.0" xmlns="http://java.sun.com/xml/ns/ 
> persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";  
> xsi:schemaLocation="http://java.sun.com/xml/ns/persistence 
> http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd 
> ">
>      <persistence-unit name="loginPU" transaction-type="RESOURCE_LOCAL">
>          <provider>org.hibernate.ejb.HibernatePersistence</provider>
>          <exclude-unlisted-classes>false</exclude-unlisted-classes>
>          <properties>
>              <property name="hibernate.cache.provider_class"  
> value="org.hibernate.cache.NoCacheProvider"/>
>              <property name="hibernate.archive.autodetection"  
> value="class"/>
>              <property name="hibernate.dialect"  
> value="org.hibernate.dialect.PostgreSQLDialect"/>
>              <property name="jdbc.batch_size" value="0"/>
>        <!-- Testing DB -->
>        <!-- Fiveish DB -->
>        <!-- <property name="hibernate.connection.username"  
> value="xxxxxxxx"/>
>        <property name="hibernate.connection.password"  
> value="xxxxxxxxx"/>
>        <property name="hibernate.connection.url"  
> value="jdbc:postgresql://localhost/cheapdb"/> -->
>        <!-- configuration connection pool via c3p0-->
>              <property name="c3p0.acquire_increment" value="1"/>
>              <property name="c3p0.idle_test_period" value="3000"/>
>        <!-- seconds -->
>              <property name="c3p0.max_size" value="20"/>
>              <property name="c3p0.max_statements" value="50"/>
>              <property name="c3p0.min_size" value="5"/>
>              <property name="c3p0.timeout" value="100"/>
>              <property name="hibernate.show_sql" value="true"/>
>              <property name="hibernate.connection.driver_class"  
> value="org.postgresql.Driver"/>
>
>        <!-- Dev -->
>
>              <property name="hibernate.connection.username"  
> value="xxxxxxxx"/>
>              <property name="hibernate.connection.password"  
> value="xxxxxxxx"/>
>              <property name="hibernate.connection.url"  
> value="jdbc:postgresql://localhost/postgres"/>
>
>
>        <!-- Production -->
>
>
>              <!-- <property name="hibernate.connection.username"  
> value="xxxxxxxx"/>
>              <property name="hibernate.connection.password"  
> value="xxxxxxxxxx"/>
>              <property name="hibernate.connection.url"  
> value="jdbc:postgresql://localhost/joaquinv_cheap"/> -->
>
>
>
>
>              <property name="hibernate.hbm2ddl.auto" value="update"/>
>          </properties>
>      </persistence-unit>
> </persistence>
>
>
>
> Thanks!
> Joaquin
>
>
>
> ------------------------------------------------------------------------------
> Start uncovering the many advantages of virtual appliances
> and start using them to simplify application deployment and
> accelerate your shift to cloud computing.
> http://p.sf.net/sfu/novell-sfdev2dev
> _______________________________________________
> Stripes-users mailing list
> Stripes-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/stripes-users
>
>   


-- 
Nikolaos Giannopoulos
Director, BrightMinds Software Inc.
e. nikol...@brightminds.org
w. www.brightminds.org
t. 1.613.822.1700
c. 1.613.797.0036
f. 1.613.822.1915


------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to