JDBC Connection Leak with Queued Datasource Calls

We’re having an issue with JDBC connection leaks when multiple DSRequests are sent from the client in a queue. In this instance, we’re sending 6 requests all in a queue for 6 dropdown fields. These requests are all sent to the same SQL datasource. The datasource looks like this:

<DataSource ID="Code"
            serverType="sql"
            tableName="code"
            beanClassName="com.assaabloy.protech.shared.datasource.bean.Code"
            xmlns:fmt="WEB-INF/">
    <fmt:bundle basename="com.assaabloy.protech.shared.Messages"/>
    <fields>
        <field name="codeId" nativeName="code_id" type="sequence" javaClass="Long" primaryKey="true" hidden="true"/>
        <field name="codeTypeId" nativeName="code_type_id" type="integer" javaClass="Long" foreignKey="CodeType.code_type_id" required="true"
               displayField="codeType">
            <title>
                <fmt:message key="codeType"/>
            </title>
        </field>
        <field name="codeType" type="text" length="100" includeFrom="CodeType.description" hidden="true"/>
        <field name="companyId" nativeName="company_id" type="text" length="36" hidden="true" foreignKey="Company.companyId" joinType="outer">
            <title>
                <fmt:message key="company"/>
            </title>
        </field>
        <field name="code" type="text" length="100" required="true">
            <title>
                <fmt:message key="code"/>
            </title>
            <validators>
                <validator type="serverCustom">
                    <serverObject lookupStyle="spring" bean="codeService"/>
                    <errorMessage>
                        <fmt:message key="codeAlreadyExists"/>
                    </errorMessage>
                </validator>
            </validators>
        </field>
        <field name="description" type="text" length="100" required="true">
            <title>
                <fmt:message key="description"/>
            </title>
        </field>
        <field name="sortOrder" nativeName="sort_order" type="integer" javaClass="Integer" hidden="true"/>
        <field name="sequenceNumber" nativeName="sequence_number" type="integer" javaClass="Integer" hidden="true"/>
        <field name="required" type="boolean" sqlStorageStrategy="integer" hidden="true"/>
        <field name="visible" type="boolean" sqlStorageStrategy="integer" hidden="true"/>
        <field name="deleted" nativeName="is_deleted" type="boolean" sqlStorageStrategy="integer" hidden="true"/>
        <field name="parentCodeId" nativeName="parent_code_id" type="integer" javaClass="Long" foreignKey="Code.codeId" joinType="outer"
               displayField="parentCodeType">
            <title>
                <fmt:message key="parentCodeType"/>
            </title>
        </field>
        <field name="parentCodeType" type="text" length="100" includeFrom="Code.code" hidden="true"/>
        <field name="createdBy" nativeName="created_by" type="creator" hidden="true">
            <title>
                <fmt:message key="createdBy"/>
            </title>
        </field>
        <field name="createdTime" nativeName="created_time" type="creatorTimestamp" hidden="true">
            <title>
                <fmt:message key="createdTime"/>
            </title>
        </field>
        <field name="modifiedBy" nativeName="modified_by" type="modifier" hidden="true">
            <title>
                <fmt:message key="modifiedBy"/>
            </title>
        </field>
        <field name="modifiedTime" nativeName="modified_time" type="modifierTimestamp" hidden="true">
            <title>
                <fmt:message key="modifiedTime"/>
            </title>
        </field>

        <field name="concatValue" type="text" canEdit="false" customSelectExpression="CONCAT(code.code,'-',code.description)" hidden="=true"/>
    </fields>

    <operationBindings>
        <operationBinding operationType="add">
            <serverObject lookupStyle="spring" bean="codeService"/>
        </operationBinding>
        <operationBinding operationType="fetch">
            <criteria fieldName="deleted" value="false"/>
        </operationBinding>
        <operationBinding operationType="fetch" operationId="getMaxSortOrder">
            <customSQL>
                SELECT
                COALESCE(MAX(sort_order)+1,0) AS sort_order FROM code WHERE
                code_type_id=$criteria.code_type_id AND (company_id = $criteria.company_id or company_id IS NULL)
            </customSQL>
        </operationBinding>
        <operationBinding operationType="remove">
            <serverObject lookupStyle="spring" bean="codeService"/>
        </operationBinding>
    </operationBindings>
</DataSource>

I’ve attached an AI generated explanation of the issue, as well as the temporary fix we’re putting in place (.md file renamed as .txt).

smartgwt-queued-fetch-connection-leak.txt (9.05 KB)

Thanks for the report - we’ve made a change to address this leak.

Please retest with a build dated July 29 or later.

Hi, is this bug also present in 13.1 by any chance?

hi Claudio - yes it is - we’ll port the fix for tomorrow’s builds.

Confirmed working, thank you for the quick fix!