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

Comments

Projects
None yet
6 participants
@mxlxm
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

This comment has been minimized.

Show comment
Hide comment
@zimulala
Member

zimulala commented Aug 30, 2017

@tiancaiamao tiancaiamao self-assigned this Aug 30, 2017

@tiancaiamao

This comment has been minimized.

Show comment
Hide comment
@tiancaiamao

tiancaiamao Aug 30, 2017

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():
}
Contributor

tiancaiamao commented Aug 30, 2017

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

time.Sleep(duration)

to

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

This comment has been minimized.

Show comment
Hide comment
@ladrift

ladrift Oct 3, 2017

Contributor

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?

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

This comment has been minimized.

Show comment
Hide comment
Member

shenli commented Oct 3, 2017

ladrift added a commit to ladrift/tidb that referenced this issue Oct 3, 2017

expression: Quit builtin function SLEEP when KILLed.
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 #4378 partially

ladrift added a commit to ladrift/tidb that referenced this issue Oct 3, 2017

expression: Quit builtin function SLEEP when KILLed.
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 #4378 partially

@shenli shenli closed this in #4708 Oct 9, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment