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

trigger TTL job manually may hang for a long time #45868

Closed
lcwangchao opened this issue Aug 7, 2023 · 0 comments · Fixed by #45869
Closed

trigger TTL job manually may hang for a long time #45868

lcwangchao opened this issue Aug 7, 2023 · 0 comments · Fixed by #45869
Labels
affects-6.6 affects-7.0 affects-7.1 This bug affects the 7.1.x(LTS) versions. affects-7.2 affects-7.3 severity/major sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug.

Comments

@lcwangchao
Copy link
Collaborator

Bug Report

Please answer these questions before submitting your issue. Thanks!

Some TTL integration test hangs and we found the goroutine is blocked with the below stack:

github.com/pingcap/tidb/ttl/client.(*etcdClient).waitCmdResponse(0xc003aacba0, {0x60cc570?, 0xc008c97f80?}, {0xc008b64f60, 0x24}, {0x4f65ca0, 0xc008ca67e0})
	/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/ttl/client/command.go:170 +0x1f4
github.com/pingcap/tidb/ttl/client.(*etcdClient).Command(0x60cc570?, {0x60cc570, 0xc008c97f80}, {0x57dfddd, 0xf}, {0x4f4faa0, 0xc00ccb5ba0}, {0x4f4fae0, 0xc00d414a98})
	/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/ttl/client/command.go:210 +0x10c
github.com/pingcap/tidb/ttl/client.TriggerNewTTLJob({0x60cc570, 0xc008c97f80}, {0x60cd728, 0xc003aacba0}, {0xc008b64f17, 0x7}, {0xc008b64f1f, 0x2})
	/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/ttl/client/command.go:106 +0x115
github.com/pingcap/tidb/server/handler/ttlhandler.TTLJobTriggerHandler.ServeHTTP({{0x60fcb40?, 0xc000036b40?}}, {0x60ca650, 0xc008cda000}, 0xc008cce300)
	/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/server/handler/ttlhandler/ttl.go:62 +0x336
github.com/gorilla/mux.(*Router).ServeHTTP(0xc0004e9800, {0x60ca650, 0xc008cda000}, 0xc008cce100)
	/go/pkg/mod/github.com/gorilla/mux@v1.8.0/mux.go:210 +0x1cf
net/http.(*ServeMux).ServeHTTP(0xc00ce8fa78?, {0x60ca650, 0xc008cda000}, 0xc008cce100)
	/usr/local/go/src/net/http/server.go:2500 +0x149
github.com/pingcap/tidb/server/internal/util.CorsHandler.ServeHTTP({{0x60a3dc0?, 0xc0014ad840?}, 0xc0002b3600?}, {0x60ca650?, 0xc008cda000?}, 0x52dae20?)
	/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/server/internal/util/util.go:219 +0x21b
net/http.serverHandler.ServeHTTP({0xc007b4eab0?}, {0x60ca650, 0xc008cda000}, 0xc008cce100)
	/usr/local/go/src/net/http/server.go:2936 +0x316
net/http.(*conn).serve(0xc007b32900, {0x60cc570, 0xc002a38330})
	/usr/local/go/src/net/http/server.go:1995 +0x612
created by net/http.(*Server).Serve
	/usr/local/go/src/net/http/server.go:3089 +0x5ed

It seems we use NewTimer by mistake (we should use NewTicker) here:

ticker := time.NewTimer(time.Second)

The bug exists in several versions but in the earlier versions, this will not be triggered because the trigger action will be returned fast even max tasks limit is reached. But in the current version, trigger action will wait for the task limit condition.

This bug only affects integration tests.

@lcwangchao lcwangchao added type/bug The issue is confirmed as a bug. severity/major labels Aug 7, 2023
@ti-chi-bot ti-chi-bot bot added may-affects-5.2 This bug maybe affects 5.2.x versions. may-affects-5.3 This bug maybe affects 5.3.x versions. may-affects-5.4 This bug maybe affects 5.4.x versions. may-affects-6.1 may-affects-6.5 may-affects-7.1 labels Aug 7, 2023
@lcwangchao lcwangchao added sig/sql-infra SIG: SQL Infra affects-6.5 This bug affects the 6.5.x(LTS) versions. affects-6.6 affects-7.0 affects-7.1 This bug affects the 7.1.x(LTS) versions. affects-7.2 affects-7.3 and removed may-affects-5.2 This bug maybe affects 5.2.x versions. may-affects-5.3 This bug maybe affects 5.3.x versions. may-affects-5.4 This bug maybe affects 5.4.x versions. may-affects-6.1 may-affects-6.5 may-affects-7.1 labels Aug 7, 2023
ti-chi-bot bot pushed a commit that referenced this issue Aug 8, 2023
@lcwangchao lcwangchao removed the affects-6.5 This bug affects the 6.5.x(LTS) versions. label Aug 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-6.6 affects-7.0 affects-7.1 This bug affects the 7.1.x(LTS) versions. affects-7.2 affects-7.3 severity/major sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant