You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "John Wagenleitner (JIRA)" <ji...@apache.org> on 2016/03/11 04:01:40 UTC

[jira] [Closed] (GROOVY-7751) CallableStatement leak in Sql.call() method

     [ https://issues.apache.org/jira/browse/GROOVY-7751?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

John Wagenleitner closed GROOVY-7751.
-------------------------------------
       Resolution: Fixed
         Assignee: John Wagenleitner
    Fix Version/s: 2.4.7

Merged the PR that should ensure the {{CallableStatement}}'s are added to the statement cache if caching is enabled.

Thanks for reporting the issue.

> CallableStatement leak in Sql.call() method
> -------------------------------------------
>
>                 Key: GROOVY-7751
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7751
>             Project: Groovy
>          Issue Type: Bug
>          Components: SQL processing
>    Affects Versions: 2.4.5
>            Reporter: Alexey Vladykin
>            Assignee: John Wagenleitner
>             Fix For: 2.4.7
>
>
> All {{Sql.call(...)}} methods ultimately delegate to {{Sql.callWithRows(...)}} method where we have:
> {code:java}
> try {
>     statement = connection.prepareCall(sql);
>     // ...
> } finally {
>     // ...
>     closeResources(connection, statement);
> }
> {code}
> The problem is that statement is unconditionally parsed and compiled each time, but the {{closeResources()}} method only closes it when statement caching is disabled. So with statement caching enabled we end up allocating and leaking a new CallableStatement instance per {{Sql.call()}} invocation.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)