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

close jdbc connection, found it is in transcation so try to rollback #2919

Open
noaso opened this issue Jul 21, 2022 · 0 comments
Open

close jdbc connection, found it is in transcation so try to rollback #2919

noaso opened this issue Jul 21, 2022 · 0 comments
Assignees
Labels

Comments

@noaso
Copy link

noaso commented Jul 21, 2022

1、bug描述
总报 "close jdbc connection, found it is in transcation so try to rollback

调用这个的时候 idleCon.close("too many idle con");
看了下源码。在close方法
if (!isAutocommit()) { rollback(); con.setAutoCommit(true); }
@Override public void rollback() { try { con.rollback(); this.respHandler.okResponse(OkPacket.OK, this); } catch (SQLException e) { throw new RuntimeException(e); } }
这里 respHandler 是 null;

idleCon.close("too many idle con");
idleCon是从 ManCommitCons取的,这个队列的offer在release中,这里把ResponseHandler设置成了null.

public void release() { modifiedSQLExecuted = false; setResponseHandler(null); pool.releaseChannel(this); }

2、版本号(非常重要)
v 1.6.7.6/20220524101549

打印了一下 rollback的 JDBCConnection信息,attachement =null,modifiedSQLExecuted=false 没太看懂。
不知道这种链接rollback后 对实际数据有影响没。
JDBCConnection [id=943,autocommit=false,pool=io.mycat.backend.jdbc.JDBCDatasource@76b01630, schema=xxxxx_275, dbType=MYSQL, oldSchema=xxxxx_275, packetId=30, txIsolation=0, running=false, borrowed=false, host=xxxxxxxx, port=3306, con=com.mysql.cj.jdbc.ConnectionImpl@15a4ddb2, respHandler=null, attachement=null, headerOutputed=false, modifiedSQLExecuted=false, startTime=1658410472471, lastTime=1658410518958, isSpark=false, processor=io.mycat.net.NIOProcessor@43e6beff]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants