C3P0: unreturnedConnectionTimeout in production?
You should debug your Connection leaks, and then not use unreturnedConnectionTimeout
in production, ideally.
To debug Connection leaks, set both unreturnedConnectionTimeout
and debugUnreturnedConnectionStackTraces
, see http://www.mchange.com/projects/c3p0/#configuring_to_debug_and_workaround_broken_clients (archived here). Then, when you have no more leaks, unset both of these parameters.
You would set unreturnedConnectionTimeout
in production mostly if for some reason you can't debug and fix the application whose Connections are leaking, in which case it's a reasonable workaround to just set unreturnedConnectionTimeout
and let c3p0 clean up what your application forgets to.
Related videos on Youtube
Monarch Wadia
Principal software developer at http://zeroprojects.ca. Happy to talk about all things web development. Feel free to message me. Ruby on Rails, Node.js, Tomcat Server, Linux & Mac, Java Jersey 2.x, REST, Nginx, API Creation, MySQL, Oracle SQL JavaScript, HTML5, CSS, Single page application / SPA Creation, Browserify, Jquery, Bootstrap 3, Gulp & Grunt, Angular.js, Bower, React.js + Flux, SASS Git, Agile Methodology, Github, Bitbucket, JIRA, Confluence, Advanced MS Excel, Advanced VBA & Macros, Microsoft Dynamics CRM
Updated on September 15, 2022Comments
-
Monarch Wadia over 1 year
The parameter
unreturnedConnectionTimeout
times out unreturned connections after a given period of time. I'm trying to decide whether I should use this in my productionpersistence.xml
? A big plus of using this is that the Connection Pool will be able to recover from leaky connections. A big minus is that leaky connections will be very difficult to detect.Should I use
unreturnedConnectionTimeout
in production applications? If yes, what should its value be? Are there any other pros/cons I should consider?