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

unable to kill query #4378

Closed
mxlxm opened this issue Aug 30, 2017 · 4 comments · Fixed by #4708
Closed

unable to kill query #4378

mxlxm opened this issue Aug 30, 2017 · 4 comments · Fixed by #4708
Assignees
Labels
good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. type/enhancement The issue or PR belongs to an enhancement.

Comments

@mxlxm
Copy link
Contributor

mxlxm commented Aug 30, 2017

  1. What did you do?
    select sleep(10);
    hit ctrl+c with the same session to cancel, or kill id in another session.

  2. What did you expect to see?
    kill the sleep query.

  3. What did you see instead?
    with ctrl+c shows ^C^C -- query aborted but blocked until the sleep query completed.
    with kill id returned ok but nothing happened, sleep query completed.

  4. What version of TiDB are you using (tidb-server -V)?
    master

@zimulala
Copy link
Contributor

@tiancaiamao

@tiancaiamao tiancaiamao self-assigned this Aug 30, 2017
@tiancaiamao
Copy link
Contributor

This is a known issue.
We should change the builtin function implementation:

time.Sleep(duration)

to

select {
case <-time.After(duration):
case <-ctx.Done():
}

@ngaut ngaut added type/enhancement The issue or PR belongs to an enhancement. good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. labels Aug 31, 2017
@ladrift
Copy link
Contributor

ladrift commented Oct 3, 2017

I am willing to tackle this issue. But, it's not easy for a new contributor to understand the structure of source code. I cannot find the related code about the builtin function sleep and its implementation.

Is there anyone can give me some hints?

@shenli
Copy link
Member

shenli commented Oct 3, 2017

ladrift added a commit to ladrift/tidb that referenced this issue Oct 3, 2017
Use cancellation pattern in SLEEP function by making use of
transaction's context. But, it does not quit when Ctrl-C
pressed. Add TODO for future investigation.

Fix pingcap#4378 partially
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. type/enhancement The issue or PR belongs to an enhancement.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants