pingcap / pingcap/tiup

`tiup bench` panic when connect is failed

Open
#197 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status/TODO type/bug
Dominant language
Go
Stars
466
Forks
338
Avg merge
3d 7h
Merged PRs (30d)
8

Description

Bug Report

Please answer these questions before submitting your issue. Thanks!

  1. What did you do?

Run tiup bench tpch prepare or other bench command without valid mysql/tidb in host:port

  1. What did you expect to see?
    Report connected failed and exit with exit code != 0

  2. What did you see instead?
    panic

>  tiup bench tpch prepare
Starting component `bench`: /Users/jayson/.tiup/components/bench/v0.0.1/bench tpch prepare
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x28 pc=0x10f59c8]

goroutine 50 [running]:
database/sql.(*Conn).close(0x0, 0x0, 0x0, 0x0, 0x0)
	/usr/local/go/src/database/sql/sql.go:1926 +0x38
database/sql.(*Conn).Close(...)
	/usr/local/go/src/database/sql/sql.go:1947
github.com/pingcap/go-tpc/tpch.Workloader.CleanupThread(0x0, 0x1a77740, 0x15cc860, 0xc000086300, 0xf)
	/go/pkg/mod/github.com/pingcap/go-tpc@v1.0.4-0.20200410025347-ee3e3247e342/tpch/workload.go:76 +0x7c
main.execute(0x15cc860, 0xc000086300, 0x15d1440, 0xc0000821e0, 0x150872b, 0x7, 0xf, 0x0, 0x0)
	/home/jenkins/agent/workspace/bench-tiup-mirror-update/components/bench/misc.go:46 +0x214
main.executeWorkload.func2(0xc000094070, 0x15cc820, 0xc0000ae0c0, 0x15d1440, 0xc0000821e0, 0x150872b, 0x7, 0xf)
	/home/jenkins/agent/workspace/bench-tiup-mirror-update/components/bench/misc.go:99 +0xc8
created by main.executeWorkload
	/home/jenkins/agent/workspace/bench-tiup-mirror-update/components/bench/misc.go:97 +0x16f
Error: run `/Users/jayson/.tiup/components/bench/v0.0.1/bench` (wd:/Users/jayson/.tiup/data/RySx8IB) failed: exit status 2
  1. What version of TiUP are you using (tiup --version)?
>  tiup --version
tiup version v0.0.5 tiup
Go Version: go1.13
Git Branch: master
GitHash: aab3add
Build Time: 2020-04-24 18:10:05 +0800

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with components/bench/misc.go, especially execute and executeWorkload, and compare them with the CleanupThread call shown in the stack trace from go-tpc's tpch/workload.go. Run tiup bench tpch prepare against an invalid host and verify that it reports the connection failure and exits nonzero without panicking.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, mysql
Domain
databases
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
40/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.