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

Goroutine leak in transaction retry #15050

Closed
djshow832 opened this issue Mar 1, 2020 · 0 comments · Fixed by pingcap/parser#755
Closed

Goroutine leak in transaction retry #15050

djshow832 opened this issue Mar 1, 2020 · 0 comments · Fixed by pingcap/parser#755
Labels
priority/P2 The issue has P2 priority. severity/moderate sig/transaction SIG:Transaction type/bug The issue is confirmed as a bug.

Comments

@djshow832
Copy link
Contributor

djshow832 commented Mar 1, 2020

Bug Report

Please answer these questions before submitting your issue. Thanks!

  1. What did you do?
    If possible, provide a recipe for reproducing the error.

Connection 1:

create table test(id int);
split table test between (0) and (2000) regions 2;
insert into test values(1), (1001);
set session tidb_distsql_scan_concurrency=1;
set session tidb_disable_txn_auto_retry=0;
begin;
update test set id=id+1;

Connection 2 (cause connection 1 to write conflict):

begin;
update test set id=id+1;
commit;

Connection 1 (continue the transaction):

(select * from test) union (select * from test);
commit;
  1. What did you expect to see?
    Check http://127.0.0.1:10080/debug/pprof/goroutine?debug=1 and see no goroutine leak.

  2. What did you see instead?
    Check http://127.0.0.1:10080/debug/pprof/goroutine?debug=1 and see goroutine leak.

  3. What version of TiDB are you using (tidb-server -V or run select tidb_version(); on TiDB)?
    v3.0.7, master, etc.

  4. Reason
    The reason is that (select * from test) union (select * from test) is not treated as read-only statement, so it's executed again when retrying the transaction. But the result set is never closed because the statement is not expected to produce results.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority/P2 The issue has P2 priority. severity/moderate sig/transaction SIG:Transaction type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants