Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSpherePreparedStatement#getResultSets,repeat resultSet #34331

Open
LeavesGirl opened this issue Jan 13, 2025 · 0 comments
Milestone

Comments

@LeavesGirl
Copy link

Bug Report

For English only, other languages will not accept.

Before report a bug, make sure you have:

Please pay attention on issues you submitted, because we maybe need more details.
If no response anymore and we cannot reproduce it on current information, we will close it.

Please answer these questions before submitting your issue. Thanks!

Which version of ShardingSphere did you use?

5.4.1

Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?

ShardingSphere-JDBC

Expected behavior


//{conn-10006, pstmt-20499, rs-51029} closed
{conn-10006, pstmt-20499, rs-51028} closed
//{conn-10006, pstmt-20500, rs-51031} closed
{conn-10006, pstmt-20500, rs-51030} closed

Actual behavior


{conn-10006, pstmt-20499, rs-51029} closed
{conn-10006, pstmt-20499, rs-51028} closed
{conn-10006, pstmt-20500, rs-51031} closed
{conn-10006, pstmt-20500, rs-51030} closed

Reason analyze (If you can)

private List<ResultSet> getResultSets() throws SQLException {
        List<ResultSet> result = new ArrayList<>(statements.size());
        for (Statement each : statements) {
            if (null != each.getResultSet()) {
                result.add(each.getResultSet());
            }
        }
        return result;
    }

each.getResultSet(), this codes would make a new instanceof resultSet,so the com.alibaba.druid.filter.Filter#resultSet_close will be called twice. com.alibaba.druid.filter.stat.StatFilterContext#addFetchRowCount,this rowCount added twice, is fault.

Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.

Example codes for reproduce this issue (such as a github link).

@taojintianxia taojintianxia added this to the 5.5.3 milestone Jan 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants