pingcap / tiup

A component manager for TiDB
https://tiup.io
Apache License 2.0
427 stars 313 forks source link

TiUP takes a long time to quit #1437

Open sticnarf opened 3 years ago

sticnarf commented 3 years ago

Bug Report

Please answer these questions before submitting your issue. Thanks!

  1. What did you do?

Run tiup cluster --version.

  1. What did you expect to see?

Print:

❯ tiup cluster --version
Starting component `cluster`: /home/yilin/.tiup/components/cluster/v1.5.1/tiup-cluster --version
tiup version 1.5.1 tiup
Go Version: go1.16.5
Git Ref: v1.5.1
GitHash: f00aeb0783f56c0766c39aa765d183a566f8f0d6

And it should quit quickly after printing.

  1. What did you see instead?

It takes a long time to exit.

  1. What version of TiUP are you using (tiup --version)?
1.5.1 tiup
Go Version: go1.16.5
Git Ref: v1.5.1
GitHash: f00aeb0783f56c0766c39aa765d183a566f8f0d6
sticnarf commented 3 years ago

After setting TIUP_CLUSTER_DEBUG envvar, it shows an i/o timeout:

❯ TIUP_CLUSTER_DEBUG=true tiup cluster --version
Starting component `cluster`: /home/yilin/.tiup/components/cluster/v1.5.1/tiup-cluster --version
tiup version 1.5.1 tiup
Go Version: go1.16.5
Git Ref: v1.5.1
GitHash: f00aeb0783f56c0766c39aa765d183a566f8f0d6
report failed: Post "https://telemetry.pingcap.com/api/v1/clusters/report": dial tcp: i/o timeout
report: installationUUID:"4d79e27a-b1fb-4463-80b1-fecb1218027d" eventUUID:"8d70a465-bcc0-4b8a-80be-c12d2fd6b669" event_unix_timestamp:1624273845 version:<TiUPVersion:"1.5.1" ComponentVersion:"1.5.1" GitRef:"v1.5.1" GitCommit:"f00aeb0783f56c0766c39aa765d183a566f8f0d6" VerName:"tiup" os:"linux" arch:"amd64" go:"go1.16.5" > cluster:<> 
report: installationUUID:"4d79e27a-b1fb-4463-80b1-fecb1218027d" eventUUID:"8d70a465-bcc0-4b8a-80be-c12d2fd6b669" event_unix_timestamp:1624273844 version:<TiUPVersion:"1.5.1" ComponentVersion:"1.5.1" GitRef:"v1.5.1" GitCommit:"f00aeb0783f56c0766c39aa765d183a566f8f0d6" VerName:"tiup" os:"linux" arch:"amd64" go:"go1.16.5" > tiup:<command:"tiup cluster" take_milliseconds:5997 custom_mirror:true >`

However, POST to the telemetry URL using curl is fast:

❯ time curl --data '{"name":"bob"}' https://telemetry.pingcap.com/api/v1/clusters/report
{"detail":"success"}curl --data '{"name":"bob"}'   0.01s user 0.00s system 4% cpu 0.214 total
Defined2014 commented 2 years ago

Meet the same problem in my wsl env. After investigation, I found http_proxy and https_proxy are been set in my terminal env, after I deleted them, the curl is as slow as tiup :(