Konstantin V. Salikhov created CAMEL-8153:
---------------------------------------------
Summary: Fix potential connection leak in StreamList mode
Key: CAMEL-8153
URL: https://issues.apache.org/jira/browse/CAMEL-8153
Project: Camel
Issue Type: Improvement
Components: camel-jdbc
Affects Versions: 2.14.0
Environment: Linux, Apache Tomcat 7.0.41
Reporter: Konstantin V. Salikhov
Priority: Minor
Attachments: leakPatch.diff
When using camel-jdbc component with newly introduced StreamList mode I've
faced a 100% reproducible connection leak issue.
My investigation leads me to Tomcat connection pool implementation - it has
problem with returing current connection from Statement object - instead of
returning pool specific proxy it returns actual JDBC connection.
There is `statement.getConnection()` line in
`org.apache.camel.component.jdbc.ResultSetIterator` so in my particular
scenario things work like this:
1) Camel borrows connection from Tomcat pool
2) Camel leaves JDBC connection and ResultSet intact as we use StreamList mode
of camel-jdbc component
3) Route processes resultset in streaming mode and completes successfully
4) Camel tries to close connection, but due to connection pool implementation
issue it closes actual JDBC connection instead of returing it to the pool
5) Actual JDBC connection is closed an connection pool is unaware of this fact
thinking it's still open and in use by application
It would be more error prone to pass proper connection object to
ResultSetIterator along with result set and not rely on
statement.getConnection() call.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)