Wednesday, October 19, 2005

Apache DBCP - never forget maxWait

Had some not so cozy hours debugging a productive app on Tomcat. The thing would spontaneously hang about once a day (The whole of Tomcat, apart from JMX was completely hung). It hung in an infinite wait in the Database-Pool. Funnily the default of the maxWait-Param is "-1", i.e. infinitely. Now, after I fixed this it runs nicely.
But it's still not clear to me, where the total deadlock came from... Maybe some thread which would not release it's connection before it got another one (to a different DB).

1 comment:

Yet Another Regular Guy said...

What did you change it to now ? If your code was not releasing connections and you have set dbcp to "no wait" then you will end up with null connections, on the ohter hand if the pool is set to grow on demand then you will have too many connections open in the end. Maybe what is working for you is just a shot term workaround ;). Let me know.