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

Panic when starting a cse TiDB with TLS config #7902

Closed
rleungx opened this issue Mar 8, 2024 · 0 comments · Fixed by #7901
Closed

Panic when starting a cse TiDB with TLS config #7902

rleungx opened this issue Mar 8, 2024 · 0 comments · Fixed by #7901
Labels
component/mcs Microservice. severity/major type/bug The issue is confirmed as a bug.

Comments

@rleungx
Copy link
Member

rleungx commented Mar 8, 2024

Bug Report

What did you do?

Start a cse TiDB with TLS config.

What did you expect to see?

Everything is ok.

What did you see instead?

start tidb-server ...
/tidb-server --store=tikv --path=serverless-cluster-pd.tidb-serverless.svc:2379 --config=/etc/tidb/tidb.toml --keyspace-activate

config file /etc/tidb/tidb.toml contained invalid configuration options: run-auto-analyze, server-memory-quota; check TiDB manual to make sure this option has not been deprecated and removed from your TiDB version if the option does not appear to be a typo
[2024/03/08 03:20:10.474 +00:00] [INFO] [memory.go:49] ["env NAMESPACE, POD_NAME, NODE_IP not set, skip init memory limits"]
[2024/03/08 03:20:10.474 +00:00] [INFO] [main.go:422] ["serverless cluster info loading..."] [keyspace=4NLo2vmPo3mAFtb]
[2024/03/08 03:20:11.475 +00:00] [WARN] [pd_service_discovery.go:861] ["[pd] failed to get cluster id"] [url=http://serverless-cluster-pd.tidb-serverless.svc:2379/] [error="[PD:client:ErrClientGetMember]error:rpc error: code = Unavailable desc = connection error: desc = \"transport: Error while dialing: dial tcp: lookup serverless-cluster-pd.tidb-serverless.svc: i/o timeout\" target:serverless-cluster-pd.tidb-serverless.svc:2379 status:TRANSIENT_FAILURE: error:rpc error: code = Unavailable desc = connection error: desc = \"transport: Error while dialing: dial tcp: lookup serverless-cluster-pd.tidb-serverless.svc: i/o timeout\" target:serverless-cluster-pd.tidb-serverless.svc:2379 status:TRANSIENT_FAILURE"]
[2024/03/08 03:20:11.475 +00:00] [WARN] [pd_service_discovery.go:861] ["[pd] failed to get cluster id"] [url=http://serverless-cluster-pd.tidb-serverless.svc:2379/] [error="[PD:client:ErrClientGetMember]error:rpc error: code = Unavailable desc = connection error: desc = \"transport: Error while dialing: dial tcp: lookup serverless-cluster-pd.tidb-serverless.svc: i/o timeout\" target:serverless-cluster-pd.tidb-serverless.svc:2379 status:TRANSIENT_FAILURE: error:rpc error: code = Unavailable desc = connection error: desc = \"transport: Error while dialing: dial tcp: lookup serverless-cluster-pd.tidb-serverless.svc: i/o timeout\" target:serverless-cluster-pd.tidb-serverless.svc:2379 status:TRANSIENT_FAILURE"]
[2024/03/08 03:20:12.475 +00:00] [WARN] [pd_service_discovery.go:861] ["[pd] failed to get cluster id"] [url=http://serverless-cluster-pd.tidb-serverless.svc:2379/] [error="[PD:client:ErrClientGetMember]error:rpc error: code = Unavailable desc = connection error: desc = \"transport: Error while dialing: dial tcp: lookup serverless-cluster-pd.tidb-serverless.svc: i/o timeout\" target:serverless-cluster-pd.tidb-serverless.svc:2379 status:TRANSIENT_FAILURE: error:rpc error: code = Unavailable desc = connection error: desc = \"transport: Error while dialing: dial tcp: lookup serverless-cluster-pd.tidb-serverless.svc: i/o timeout\" target:serverless-cluster-pd.tidb-serverless.svc:2379 status:TRANSIENT_FAILURE"]
[2024/03/08 03:20:13.479 +00:00] [INFO] [pd_service_discovery.go:1016] ["[pd] update member urls"] [old-urls="[http://serverless-cluster-pd.tidb-serverless.svc:2379/]"] [new-urls="[http://serverless-cluster-pd-0.serverless-cluster-pd-peer.tidb-serverless.svc:2379,http://serverless-cluster-pd-1.serverless-cluster-pd-peer.tidb-serverless.svc:2379,http://serverless-cluster-pd-2.serverless-cluster-pd-peer.tidb-serverless.svc:2379]"]
[2024/03/08 03:20:13.480 +00:00] [INFO] [pd_service_discovery.go:1043] ["[pd] switch leader"] [new-leader=http://serverless-cluster-pd-0.serverless-cluster-pd-peer.tidb-serverless.svc:2379/] [old-leader=]
[2024/03/08 03:20:13.480 +00:00] [INFO] [pd_service_discovery.go:525] ["[pd] init cluster id"] [cluster-id=7187976276065784319]
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0x262728c]

goroutine 1 [running]:
[github.com/tikv/pd/client.(*client).LoadKeyspace](http://github.com/tikv/pd/client.(*client).LoadKeyspace)(0x4000ff2bb0, {0x6257fc0, 0x9152080}, {0x400007602e, 0xf})
	/go/cache/[github.com/tikv/pd/client@v0.0.0-20240301074832-6cb89172ce73/keyspace_client.go:59](http://github.com/tikv/pd/client@v0.0.0-20240301074832-6cb89172ce73/keyspace_client.go:59) +0x28c
[github.com/tikv/pd/client.(*client).loadKeyspaceMeta](http://github.com/tikv/pd/client.(*client).loadKeyspaceMeta)(0x4000ff2bb0, {0x400007602e?, 0x4000c3d8b0?})
	/go/cache/[github.com/tikv/pd/client@v0.0.0-20240301074832-6cb89172ce73/client.go:558](http://github.com/tikv/pd/client@v0.0.0-20240301074832-6cb89172ce73/client.go:558) +0x3c
[github.com/tikv/pd/client.(*client).initRetry](http://github.com/tikv/pd/client.(*client).initRetry)(0x4000ff2bb0, 0x40013bf278, {0x400007602e, 0xf})
	/go/cache/[github.com/tikv/pd/client@v0.0.0-20240301074832-6cb89172ce73/client.go:545](http://github.com/tikv/pd/client@v0.0.0-20240301074832-6cb89172ce73/client.go:545) +0xbc
[github.com/tikv/pd/client.newClientWithKeyspaceName.func1()](http://github.com/tikv/pd/client.newClientWithKeyspaceName.func1())
	/go/cache/[github.com/tikv/pd/client@v0.0.0-20240301074832-6cb89172ce73/client.go:514](http://github.com/tikv/pd/client@v0.0.0-20240301074832-6cb89172ce73/client.go:514) +0x44
[github.com/tikv/pd/client.(*pdServiceDiscovery).Init(0x4000ab8780)](http://github.com/tikv/pd/client.(*pdServiceDiscovery).Init(0x4000ab8780))
	/go/cache/[github.com/tikv/pd/client@v0.0.0-20240301074832-6cb89172ce73/pd_service_discovery.go:530](http://github.com/tikv/pd/client@v0.0.0-20240301074832-6cb89172ce73/pd_service_discovery.go:530) +0x12c
[github.com/tikv/pd/client.(*client).setup(0x4000ff2bb0)](http://github.com/tikv/pd/client.(*client).setup(0x4000ff2bb0))
	/go/cache/[github.com/tikv/pd/client@v0.0.0-20240301074832-6cb89172ce73/client.go:573](http://github.com/tikv/pd/client@v0.0.0-20240301074832-6cb89172ce73/client.go:573) +0x40
[github.com/tikv/pd/client.newClientWithKeyspaceName](http://github.com/tikv/pd/client.newClientWithKeyspaceName)({0x6257f88, 0x9152080}, {0x400007602e, 0xf}, {0x400106bff0, 0x1, 0x1}, {{0x4000f8fa00, 0x18}, {0x4000f8fa40, ...}, ...}, ...)
	/go/cache/[github.com/tikv/pd/client@v0.0.0-20240301074832-6cb89172ce73/client.go:526](http://github.com/tikv/pd/client@v0.0.0-20240301074832-6cb89172ce73/client.go:526) +0x36c
[github.com/tikv/pd/client.NewClientWithAPIContext](http://github.com/tikv/pd/client.NewClientWithAPIContext)({0x6257f88, 0x9152080}, {0x6233050, 0x4001072000}, {0x400106bff0, 0x1, 0x1}, {{0x4000f8fa00, 0x18}, {0x4000f8fa40, ...}, ...}, ...)
	/go/cache/[github.com/tikv/pd/client@v0.0.0-20240301074832-6cb89172ce73/client.go:475](http://github.com/tikv/pd/client@v0.0.0-20240301074832-6cb89172ce73/client.go:475) +0xc4
main.getServerlessInfo()
	/go/src/[github.com/pingcap/tidb/tidb-server/main.go:427](http://github.com/pingcap/tidb/tidb-server/main.go:427) +0x384
main.main()
	/go/src/[github.com/pingcap/tidb/tidb-server/main.go:266](http://github.com/pingcap/tidb/tidb-server/main.go:266) +0x3b0

The reason is that we use a sync map to manage the connection between TiDB and PD. If TiDB has TLS config and PD uses HTTP schema, the pd client will trim the HTTP prefix when reading the key from the map. But when writing to the map, the key has a prefix. So it will read nothing about connection.

What version of PD are you using (pd-server -V)?

master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/mcs Microservice. severity/major type/bug The issue is confirmed as a bug.
Projects
Development

Successfully merging a pull request may close this issue.

1 participant