You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Federico Mariani (Jira)" <ji...@apache.org> on 2026/07/13 09:36:00 UTC

[jira] [Created] (CAMEL-24045) camel-sql - Connection leak with outputType=StreamList when the statement is not a query

Federico Mariani created CAMEL-24045:
----------------------------------------

             Summary: camel-sql - Connection leak with outputType=StreamList when the statement is not a query
                 Key: CAMEL-24045
                 URL: https://issues.apache.org/jira/browse/CAMEL-24045
             Project: Camel
          Issue Type: Bug
          Components: camel-sql
            Reporter: Federico Mariani
            Assignee: Federico Mariani


SqlProducer.processStreamList() obtains a raw connection from the DataSource so it can stay open while the exchange is routed. When {{PreparedStatement.execute()}} returns false (INSERT/UPDATE/DELETE/DDL), the result-set branch is skipped: no {{ResultSetIteratorCompletion}} is registered and neither the connection nor the statement is ever closed (the catch block only closes on exception).

The executed SQL can vary per exchange via the {{CamelSqlQuery}} header or {{useMessageBodyForSql=true}}, so each such exchange leaks one pooled connection, eventually exhausting the pool. Reproduced with a connection-counting DataSource: one connection remains open after the exchange completes.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)