diff --git a/DEPS.bzl b/DEPS.bzl index 6165078e5d9ff..2a9004c21455b 100644 --- a/DEPS.bzl +++ b/DEPS.bzl @@ -718,6 +718,21 @@ def go_deps(): sum = "h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=", version = "v1.1.1", ) + go_repository( + name = "com_github_decred_dcrd_crypto_blake256", + build_file_proto_mode = "disable", + importpath = "github.com/decred/dcrd/crypto/blake256", + sum = "h1:/8DMNYp9SGi5f0w7uCm6d6M4OU2rGFK09Y2A4Xv7EE0=", + version = "v1.0.0", + ) + go_repository( + name = "com_github_decred_dcrd_dcrec_secp256k1_v4", + build_file_proto_mode = "disable", + importpath = "github.com/decred/dcrd/dcrec/secp256k1/v4", + sum = "h1:HbphB4TFFXpv7MNrT52FGrrgVXF1owhMVTHFZIlnvd4=", + version = "v4.1.0", + ) + go_repository( name = "com_github_denis_tingaikin_go_header", build_file_proto_mode = "disable", @@ -1242,6 +1257,14 @@ def go_deps(): sum = "h1:CoAavW/wd/kulfZmSIBt6p24n4j7tHgNVCjsfHVNUbo=", version = "v1.0.2", ) + go_repository( + name = "com_github_goccy_go_json", + build_file_proto_mode = "disable", + importpath = "github.com/goccy/go-json", + sum = "h1:/pAaQDLHEoCq/5FFmSKBswWmK6H0e8g4159Kc/X/nqk=", + version = "v0.9.11", + ) + go_repository( name = "com_github_godbus_dbus_v5", build_file_proto_mode = "disable_global", @@ -1490,14 +1513,6 @@ def go_deps(): sum = "h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=", version = "v1.3.0", ) - go_repository( - name = "com_github_googleapis_enterprise_certificate_proxy", - build_file_proto_mode = "disable", - importpath = "github.com/googleapis/enterprise-certificate-proxy", - sum = "h1:7MYGT2XEMam7Mtzv1yDUYXANedWvwk3HKkR3MyGowy8=", - version = "v0.0.0-20220520183353-fd19c99a87aa", - ) - go_repository( name = "com_github_googleapis_gax_go_v2", build_file_proto_mode = "disable_global", @@ -1512,14 +1527,6 @@ def go_deps(): sum = "h1:l6N3VoaVzTncYYW+9yOz2LJJammFZGBO13sqgEhpy9g=", version = "v0.2.0", ) - go_repository( - name = "com_github_googleapis_go_type_adapters", - build_file_proto_mode = "disable", - importpath = "github.com/googleapis/go-type-adapters", - sum = "h1:9XdMn+d/G57qq1s8dNc5IesGCXHf6V2HZ2JwRxfA2tA=", - version = "v1.0.0", - ) - go_repository( name = "com_github_gophercloud_gophercloud", build_file_proto_mode = "disable", @@ -2262,6 +2269,49 @@ def go_deps(): sum = "h1:tC2y/ygPbMFSBOs3DcyaEMKnnwH7eYKzohOtRrf0SAg=", version = "v1.1.0", ) + go_repository( + name = "com_github_lestrrat_go_blackmagic", + build_file_proto_mode = "disable", + importpath = "github.com/lestrrat-go/blackmagic", + sum = "h1:lS5Zts+5HIC/8og6cGHb0uCcNCa3OUt1ygh3Qz2Fe80=", + version = "v1.0.1", + ) + go_repository( + name = "com_github_lestrrat_go_httpcc", + build_file_proto_mode = "disable", + importpath = "github.com/lestrrat-go/httpcc", + sum = "h1:ydWCStUeJLkpYyjLDHihupbn2tYmZ7m22BGkcvZZrIE=", + version = "v1.0.1", + ) + go_repository( + name = "com_github_lestrrat_go_httprc", + build_file_proto_mode = "disable", + importpath = "github.com/lestrrat-go/httprc", + sum = "h1:bAZymwoZQb+Oq8MEbyipag7iSq6YIga8Wj6GOiJGdI8=", + version = "v1.0.4", + ) + go_repository( + name = "com_github_lestrrat_go_iter", + build_file_proto_mode = "disable", + importpath = "github.com/lestrrat-go/iter", + sum = "h1:gMXo1q4c2pHmC3dn8LzRhJfP1ceCbgSiT9lUydIzltI=", + version = "v1.0.2", + ) + go_repository( + name = "com_github_lestrrat_go_jwx_v2", + build_file_proto_mode = "disable", + importpath = "github.com/lestrrat-go/jwx/v2", + sum = "h1:RlyYNLV892Ed7+FTfj1ROoF6x7WxL965PGTHso/60G0=", + version = "v2.0.6", + ) + go_repository( + name = "com_github_lestrrat_go_option", + build_file_proto_mode = "disable", + importpath = "github.com/lestrrat-go/option", + sum = "h1:WqAWL8kh8VcSoD6xjSH34/1m8yxluXQbDeKNfvFeEO4=", + version = "v1.0.0", + ) + go_repository( name = "com_github_lib_pq", build_file_proto_mode = "disable", @@ -2795,14 +2845,6 @@ def go_deps(): sum = "h1:9UY3+iC23yxF0UfGaYrGplQ+79Rg+h/q9FV9ix19jjM=", version = "v2.6.1+incompatible", ) - go_repository( - name = "com_github_pierrec_lz4_v4", - build_file_proto_mode = "disable", - importpath = "github.com/pierrec/lz4/v4", - sum = "h1:MO0/ucJhngq7299dKLwIMtgTfbkoSPF6AoMYDd8Q4q0=", - version = "v4.1.15", - ) - go_repository( name = "com_github_pingcap_badger", build_file_proto_mode = "disable_global", @@ -2880,14 +2922,6 @@ def go_deps(): sum = "h1:49lOXmGaUpV9Fz3gd7TFZY106KVlPVa5jcYD1gaQf98=", version = "v0.0.0-20180916011732-0a3d74bf9ce4", ) - go_repository( - name = "com_github_pkg_diff", - build_file_proto_mode = "disable", - importpath = "github.com/pkg/diff", - sum = "h1:aoZm08cpOy4WuID//EZDgcC4zIxODThtZNPirFr42+A=", - version = "v0.0.0-20210226163009-20ebb0f2a09e", - ) - go_repository( name = "com_github_pkg_errors", build_file_proto_mode = "disable_global", @@ -3211,14 +3245,6 @@ def go_deps(): sum = "h1:TKdv8HiTLgE5wdJuEML90aBgNWsokNbMijUGhmcoBJc=", version = "v2.1.4+incompatible", ) - go_repository( - name = "com_github_shopify_toxiproxy_v2", - build_file_proto_mode = "disable", - importpath = "github.com/Shopify/toxiproxy/v2", - sum = "h1:O1e4Jfvr/hefNTNu+8VtdEG5lSeamJRo4aKhMOKNM64=", - version = "v2.4.0", - ) - go_repository( name = "com_github_shopspring_decimal", build_file_proto_mode = "disable", @@ -3579,13 +3605,6 @@ def go_deps(): sum = "h1:hh+/cpIcopyMYbZNVov9iSxvJU3OYQg78Sfaqzi/CzI=", version = "v0.0.5", ) - go_repository( - name = "com_github_urfave_cli_v2", - build_file_proto_mode = "disable", - importpath = "github.com/urfave/cli/v2", - sum = "h1:qph92Y649prgesehzOrQjdWyxFOp/QVM+6imKHad91M=", - version = "v2.3.0", - ) go_repository( name = "com_github_urfave_negroni", @@ -3660,28 +3679,6 @@ def go_deps(): sum = "h1:9DDCDwOyEy/gId+IEMrFHLuQ5R/WV0KNxWLler8X2OY=", version = "v0.0.0-20161129230411-ed8402a42d5f", ) - go_repository( - name = "com_github_xdg_go_pbkdf2", - build_file_proto_mode = "disable", - importpath = "github.com/xdg-go/pbkdf2", - sum = "h1:Su7DPu48wXMwC3bs7MCNG+z4FhcyEuz5dlvchbq0B0c=", - version = "v1.0.0", - ) - go_repository( - name = "com_github_xdg_go_scram", - build_file_proto_mode = "disable", - importpath = "github.com/xdg-go/scram", - sum = "h1:VOMT+81stJgXW3CpHyqHN3AXDYIMsx56mEFrB37Mb/E=", - version = "v1.1.1", - ) - go_repository( - name = "com_github_xdg_go_stringprep", - build_file_proto_mode = "disable", - importpath = "github.com/xdg-go/stringprep", - sum = "h1:kdwGpVNwPFtjs98xCGkHjQtGKh86rDcRZN17QEMCOIs=", - version = "v1.0.3", - ) - go_repository( name = "com_github_xdg_scram", build_file_proto_mode = "disable_global", @@ -4334,8 +4331,8 @@ def go_deps(): name = "org_golang_x_crypto", build_file_proto_mode = "disable_global", importpath = "golang.org/x/crypto", - sum = "h1:kUhD7nTDoI3fVd9G4ORWrbV5NY0liEs/Jg2pv5f+bBA=", - version = "v0.0.0-20220411220226-7b82a4e95df4", + sum = "h1:MDRAIl0xIo9Io2xV565hzXHw3zVseKrJKodhohM5CjU=", + version = "v0.1.0", ) go_repository( name = "org_golang_x_exp", @@ -4384,8 +4381,8 @@ def go_deps(): name = "org_golang_x_net", build_file_proto_mode = "disable_global", importpath = "golang.org/x/net", - sum = "h1:PxfKdU9lEEDYjdIzOtC4qFWgkU2rGHdKlKowJSMN9h0=", - version = "v0.0.0-20220722155237-a158d28d115b", + sum = "h1:hZ/3BUoy5aId7sCpA/Tc5lt8DkFgdVS2onTpJsZ/fl0=", + version = "v0.1.0", ) go_repository( name = "org_golang_x_oauth2", @@ -4405,22 +4402,22 @@ def go_deps(): name = "org_golang_x_sys", build_file_proto_mode = "disable_global", importpath = "golang.org/x/sys", - sum = "h1:BkDtF2Ih9xZ7le9ndzTA7KJow28VbQW3odyk/8drmuI=", - version = "v0.0.0-20220928140112-f11e5e49a4ec", + sum = "h1:kunALQeHf1/185U1i0GOB/fy1IPRDDpuoOOqRReG57U=", + version = "v0.1.0", ) go_repository( name = "org_golang_x_term", build_file_proto_mode = "disable_global", importpath = "golang.org/x/term", - sum = "h1:JGgROgKl9N8DuW20oFS5gxc+lE67/N3FcwmBPMe7ArY=", - version = "v0.0.0-20210927222741-03fcf44c2211", + sum = "h1:g6Z6vPFA9dYBAF7DWcH6sCcOntplXsDKcliusYijMlw=", + version = "v0.1.0", ) go_repository( name = "org_golang_x_text", build_file_proto_mode = "disable_global", importpath = "golang.org/x/text", - sum = "h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=", - version = "v0.3.7", + sum = "h1:BrVqGRd7+k1DiOgtnFvAkoQEWQvBc25ouMJM6429SFg=", + version = "v0.4.0", ) go_repository( name = "org_golang_x_time", diff --git a/bindinfo/main_test.go b/bindinfo/main_test.go index ede7172be10a6..65d9859fbea21 100644 --- a/bindinfo/main_test.go +++ b/bindinfo/main_test.go @@ -25,6 +25,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"), } diff --git a/br/pkg/backup/main_test.go b/br/pkg/backup/main_test.go index 86aab670ef61a..7c6c43a5743c4 100644 --- a/br/pkg/backup/main_test.go +++ b/br/pkg/backup/main_test.go @@ -25,6 +25,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("github.com/klauspost/compress/zstd.(*blockDec).startDecoder"), goleak.IgnoreTopFunction("github.com/pingcap/goleveldb/leveldb.(*DB).mpoolDrain"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), diff --git a/br/pkg/checksum/main_test.go b/br/pkg/checksum/main_test.go index 2ce42a4dc3266..f81a602724a92 100644 --- a/br/pkg/checksum/main_test.go +++ b/br/pkg/checksum/main_test.go @@ -24,6 +24,7 @@ import ( func TestMain(m *testing.M) { opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("github.com/klauspost/compress/zstd.(*blockDec).startDecoder"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), } diff --git a/br/pkg/conn/main_test.go b/br/pkg/conn/main_test.go index 9ab9ec0d31297..f6df9f2c568a4 100644 --- a/br/pkg/conn/main_test.go +++ b/br/pkg/conn/main_test.go @@ -24,6 +24,7 @@ import ( func TestMain(m *testing.M) { opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"), } diff --git a/br/pkg/lightning/checkpoints/main_test.go b/br/pkg/lightning/checkpoints/main_test.go index aa707ae68ea51..2d281fb84dd1e 100644 --- a/br/pkg/lightning/checkpoints/main_test.go +++ b/br/pkg/lightning/checkpoints/main_test.go @@ -25,6 +25,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("github.com/klauspost/compress/zstd.(*blockDec).startDecoder"), goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"), } diff --git a/br/pkg/lightning/common/main_test.go b/br/pkg/lightning/common/main_test.go index 89c3779ccc1b2..be6188947f62c 100644 --- a/br/pkg/lightning/common/main_test.go +++ b/br/pkg/lightning/common/main_test.go @@ -25,6 +25,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"), } goleak.VerifyTestMain(m, opts...) diff --git a/br/pkg/lightning/mydump/main_test.go b/br/pkg/lightning/mydump/main_test.go index f2672cd1bbc89..d4a29a47175d3 100644 --- a/br/pkg/lightning/mydump/main_test.go +++ b/br/pkg/lightning/mydump/main_test.go @@ -25,6 +25,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"), goleak.IgnoreTopFunction("github.com/klauspost/compress/zstd.(*blockDec).startDecoder"), } diff --git a/br/pkg/metautil/main_test.go b/br/pkg/metautil/main_test.go index 700d234b0182d..2b87f6047b950 100644 --- a/br/pkg/metautil/main_test.go +++ b/br/pkg/metautil/main_test.go @@ -24,6 +24,7 @@ import ( func TestMain(m *testing.M) { opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"), } testsetup.SetupForCommonTest() diff --git a/br/pkg/mock/mock_cluster_test.go b/br/pkg/mock/mock_cluster_test.go index 8a81c6e1ef6ee..37f24e8a7eca6 100644 --- a/br/pkg/mock/mock_cluster_test.go +++ b/br/pkg/mock/mock_cluster_test.go @@ -14,9 +14,11 @@ func TestSmoke(t *testing.T) { defer goleak.VerifyNone( t, goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("github.com/klauspost/compress/zstd.(*blockDec).startDecoder"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), - goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start")) + goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"), + ) m, err := mock.NewCluster() require.NoError(t, err) require.NoError(t, m.Start()) diff --git a/br/pkg/pdutil/main_test.go b/br/pkg/pdutil/main_test.go index 86b9c6e1a61ad..8af7ac001aaa4 100644 --- a/br/pkg/pdutil/main_test.go +++ b/br/pkg/pdutil/main_test.go @@ -25,6 +25,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"), } diff --git a/br/pkg/restore/main_test.go b/br/pkg/restore/main_test.go index 43df5b07d486d..a71c8db57c79f 100644 --- a/br/pkg/restore/main_test.go +++ b/br/pkg/restore/main_test.go @@ -28,6 +28,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("github.com/klauspost/compress/zstd.(*blockDec).startDecoder"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"), diff --git a/br/pkg/rtree/main_test.go b/br/pkg/rtree/main_test.go index 6c415ec6e7593..dc57d20e599d0 100644 --- a/br/pkg/rtree/main_test.go +++ b/br/pkg/rtree/main_test.go @@ -25,6 +25,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"), } diff --git a/br/pkg/summary/main_test.go b/br/pkg/summary/main_test.go index 48d22e0e5ea11..e167e079b78ff 100644 --- a/br/pkg/summary/main_test.go +++ b/br/pkg/summary/main_test.go @@ -25,6 +25,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"), } diff --git a/br/pkg/trace/main_test.go b/br/pkg/trace/main_test.go index 3447b03df11db..299dc7a11398f 100644 --- a/br/pkg/trace/main_test.go +++ b/br/pkg/trace/main_test.go @@ -25,6 +25,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"), } diff --git a/br/pkg/utils/main_test.go b/br/pkg/utils/main_test.go index b575947bf44f8..f1a0e7c1e39e5 100644 --- a/br/pkg/utils/main_test.go +++ b/br/pkg/utils/main_test.go @@ -24,6 +24,7 @@ import ( func TestMain(m *testing.M) { opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"), } testsetup.SetupForCommonTest() diff --git a/cmd/ddltest/main_test.go b/cmd/ddltest/main_test.go index 6016cb9c8d12a..7f6815d4f6340 100644 --- a/cmd/ddltest/main_test.go +++ b/cmd/ddltest/main_test.go @@ -34,6 +34,7 @@ func TestMain(m *testing.M) { } opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"), goleak.IgnoreTopFunction("internal/poll.runtime_pollWait"), diff --git a/config/config.go b/config/config.go index b598fcafa3808..4deb0d9c9c0ad 100644 --- a/config/config.go +++ b/config/config.go @@ -86,6 +86,8 @@ const ( DefMemoryUsageAlarmRatio = 0.8 // DefTempDir is the default temporary directory path for TiDB. DefTempDir = "/tmp/tidb" + // DefAuthTokenRefreshInterval is the default time interval to refresh tidb auth token. + DefAuthTokenRefreshInterval = time.Hour ) // Valid config maps @@ -546,6 +548,10 @@ type Security struct { MinTLSVersion string `toml:"tls-version" json:"tls-version"` RSAKeySize int `toml:"rsa-key-size" json:"rsa-key-size"` SecureBootstrap bool `toml:"secure-bootstrap" json:"secure-bootstrap"` + // The path of the JWKS for tidb_auth_token authentication + AuthTokenJWKS string `toml:"auth-token-jwks" json:"auth-token-jwks"` + // The refresh time interval of JWKS + AuthTokenRefreshInterval string `toml:"auth-token-refresh-interval" json:"auth-token-refresh-interval"` } // The ErrConfigValidationFailed error is used so that external callers can do a type assertion @@ -959,6 +965,8 @@ var defaultConf = Config{ EnableSEM: false, AutoTLS: false, RSAKeySize: 4096, + AuthTokenJWKS: "", + AuthTokenRefreshInterval: DefAuthTokenRefreshInterval.String(), }, DeprecateIntegerDisplayWidth: false, EnableEnumLengthLimit: true, diff --git a/config/main_test.go b/config/main_test.go index 363fd39d78304..3458dc358ad86 100644 --- a/config/main_test.go +++ b/config/main_test.go @@ -25,6 +25,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"), } diff --git a/ddl/concurrentddltest/main_test.go b/ddl/concurrentddltest/main_test.go index d6b52492ddb07..4ab7e96eab2ae 100644 --- a/ddl/concurrentddltest/main_test.go +++ b/ddl/concurrentddltest/main_test.go @@ -36,6 +36,7 @@ func TestMain(m *testing.M) { opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"), } diff --git a/ddl/failtest/main_test.go b/ddl/failtest/main_test.go index 90097bae51e71..c136cb0fa6b94 100644 --- a/ddl/failtest/main_test.go +++ b/ddl/failtest/main_test.go @@ -36,6 +36,7 @@ func TestMain(m *testing.M) { opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), } diff --git a/ddl/label/main_test.go b/ddl/label/main_test.go index b077fcc255bcc..559584b77f407 100644 --- a/ddl/label/main_test.go +++ b/ddl/label/main_test.go @@ -25,6 +25,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"), } diff --git a/ddl/main_test.go b/ddl/main_test.go index 9341be34dfb96..3418d16a23ece 100644 --- a/ddl/main_test.go +++ b/ddl/main_test.go @@ -60,6 +60,7 @@ func TestMain(m *testing.M) { opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), goleak.IgnoreTopFunction("github.com/tikv/client-go/v2/txnkv/transaction.keepAlive"), goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"), diff --git a/ddl/metadatalocktest/main_test.go b/ddl/metadatalocktest/main_test.go index 62dbb9a626287..4a52dad904905 100644 --- a/ddl/metadatalocktest/main_test.go +++ b/ddl/metadatalocktest/main_test.go @@ -36,6 +36,7 @@ func TestMain(m *testing.M) { opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"), } diff --git a/ddl/util/main_test.go b/ddl/util/main_test.go index a28cdcb4b5bfc..ae8004db124ba 100644 --- a/ddl/util/main_test.go +++ b/ddl/util/main_test.go @@ -25,6 +25,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), } goleak.VerifyTestMain(m, opts...) diff --git a/distsql/main_test.go b/distsql/main_test.go index 1d8765d866f59..10e6ed474ce70 100644 --- a/distsql/main_test.go +++ b/distsql/main_test.go @@ -25,6 +25,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"), } diff --git a/domain/globalconfigsync/globalconfig_test.go b/domain/globalconfigsync/globalconfig_test.go index a3cbd5e143a0b..c7dab0064dedb 100644 --- a/domain/globalconfigsync/globalconfig_test.go +++ b/domain/globalconfigsync/globalconfig_test.go @@ -36,6 +36,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), } goleak.VerifyTestMain(m, opts...) diff --git a/domain/infosync/info_test.go b/domain/infosync/info_test.go index 1a043e8decf2d..90a30d8f1f161 100644 --- a/domain/infosync/info_test.go +++ b/domain/infosync/info_test.go @@ -40,6 +40,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), } goleak.VerifyTestMain(m, opts...) diff --git a/domain/main_test.go b/domain/main_test.go index 163fedbad111a..f236b8461fa12 100644 --- a/domain/main_test.go +++ b/domain/main_test.go @@ -27,6 +27,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"), } diff --git a/dumpling/export/main_test.go b/dumpling/export/main_test.go index d66fb40eee907..da19d470dc94f 100644 --- a/dumpling/export/main_test.go +++ b/dumpling/export/main_test.go @@ -49,6 +49,7 @@ func TestMain(m *testing.M) { opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"), } diff --git a/executor/aggfuncs/main_test.go b/executor/aggfuncs/main_test.go index 9092f6a465d77..09b07cea808ec 100644 --- a/executor/aggfuncs/main_test.go +++ b/executor/aggfuncs/main_test.go @@ -25,6 +25,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"), } diff --git a/executor/analyzetest/main_test.go b/executor/analyzetest/main_test.go index 386cd07da7beb..5ebf42dc764a2 100644 --- a/executor/analyzetest/main_test.go +++ b/executor/analyzetest/main_test.go @@ -23,6 +23,7 @@ import ( func TestMain(m *testing.M) { opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"), } goleak.VerifyTestMain(m, opts...) diff --git a/executor/fktest/main_test.go b/executor/fktest/main_test.go index ebdcfdd1c9a1c..00c470717f529 100644 --- a/executor/fktest/main_test.go +++ b/executor/fktest/main_test.go @@ -35,6 +35,7 @@ func TestMain(m *testing.M) { opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), goleak.IgnoreTopFunction("gopkg.in/natefinch/lumberjack%2ev2.(*Logger).millRun"), goleak.IgnoreTopFunction("github.com/tikv/client-go/v2/txnkv/transaction.keepAlive"), diff --git a/executor/kvtest/main_test.go b/executor/kvtest/main_test.go index 4ca44232f2973..592d8ba5276bf 100644 --- a/executor/kvtest/main_test.go +++ b/executor/kvtest/main_test.go @@ -35,6 +35,7 @@ func TestMain(m *testing.M) { opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"), goleak.IgnoreTopFunction("gopkg.in/natefinch/lumberjack%2ev2.(*Logger).millRun"), diff --git a/executor/main_test.go b/executor/main_test.go index 0c951915222cf..512eced5b50fa 100644 --- a/executor/main_test.go +++ b/executor/main_test.go @@ -56,6 +56,7 @@ func TestMain(m *testing.M) { opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), goleak.IgnoreTopFunction("gopkg.in/natefinch/lumberjack%2ev2.(*Logger).millRun"), goleak.IgnoreTopFunction("github.com/tikv/client-go/v2/txnkv/transaction.keepAlive"), diff --git a/executor/memtest/main_test.go b/executor/memtest/main_test.go index 5d3f98d407583..a3b3edb4ff962 100644 --- a/executor/memtest/main_test.go +++ b/executor/memtest/main_test.go @@ -35,6 +35,7 @@ func TestMain(m *testing.M) { opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"), goleak.IgnoreTopFunction("gopkg.in/natefinch/lumberjack%2ev2.(*Logger).millRun"), diff --git a/executor/oomtest/oom_test.go b/executor/oomtest/oom_test.go index 5da9d29ddc585..853b687f8c273 100644 --- a/executor/oomtest/oom_test.go +++ b/executor/oomtest/oom_test.go @@ -37,6 +37,7 @@ func TestMain(m *testing.M) { registerHook() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), } goleak.VerifyTestMain(m, opts...) diff --git a/executor/seqtest/main_test.go b/executor/seqtest/main_test.go index 5a1e3d84813f4..299cc69a8a26f 100644 --- a/executor/seqtest/main_test.go +++ b/executor/seqtest/main_test.go @@ -30,6 +30,7 @@ func TestMain(m *testing.M) { }) opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("github.com/pingcap/tidb/executor.readProjectionInput"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"), diff --git a/executor/showtest/main_test.go b/executor/showtest/main_test.go index 131b0b82b1289..cc9e1f5aecbb3 100644 --- a/executor/showtest/main_test.go +++ b/executor/showtest/main_test.go @@ -35,6 +35,7 @@ func TestMain(m *testing.M) { opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), goleak.IgnoreTopFunction("gopkg.in/natefinch/lumberjack%2ev2.(*Logger).millRun"), goleak.IgnoreTopFunction("github.com/tikv/client-go/v2/txnkv/transaction.keepAlive"), diff --git a/executor/simpletest/main_test.go b/executor/simpletest/main_test.go index d90b80dbc4a84..6772de87c1301 100644 --- a/executor/simpletest/main_test.go +++ b/executor/simpletest/main_test.go @@ -23,6 +23,7 @@ import ( func TestMain(m *testing.M) { opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("github.com/tikv/client-go/v2/txnkv/transaction.keepAlive"), } goleak.VerifyTestMain(m, opts...) diff --git a/executor/splittest/main_test.go b/executor/splittest/main_test.go index a9d6be9bc0212..c7f44e57f49d5 100644 --- a/executor/splittest/main_test.go +++ b/executor/splittest/main_test.go @@ -23,6 +23,7 @@ import ( func TestMain(m *testing.M) { opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), } goleak.VerifyTestMain(m, opts...) } diff --git a/executor/tiflashtest/main_test.go b/executor/tiflashtest/main_test.go index 60681a496f07a..708cb54bb0283 100644 --- a/executor/tiflashtest/main_test.go +++ b/executor/tiflashtest/main_test.go @@ -39,6 +39,7 @@ func TestMain(m *testing.M) { view.Stop() }), goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), goleak.IgnoreTopFunction("gopkg.in/natefinch/lumberjack%2ev2.(*Logger).millRun"), goleak.IgnoreTopFunction("github.com/tikv/client-go/v2/txnkv/transaction.keepAlive"), diff --git a/expression/aggregation/main_test.go b/expression/aggregation/main_test.go index deead25faaadc..11504899f250f 100644 --- a/expression/aggregation/main_test.go +++ b/expression/aggregation/main_test.go @@ -25,6 +25,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), } goleak.VerifyTestMain(m, opts...) diff --git a/expression/main_test.go b/expression/main_test.go index 16fdf0574eb75..1875fcaf9869d 100644 --- a/expression/main_test.go +++ b/expression/main_test.go @@ -53,6 +53,7 @@ func TestMain(m *testing.M) { opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"), } diff --git a/extension/main_test.go b/extension/main_test.go index 82f6f903456ef..7ffc36a917470 100644 --- a/extension/main_test.go +++ b/extension/main_test.go @@ -25,6 +25,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"), } diff --git a/go.mod b/go.mod index 41fb7aa9d4a27..200010fa4ac82 100644 --- a/go.mod +++ b/go.mod @@ -57,6 +57,7 @@ require ( github.com/kisielk/errcheck v1.6.2 github.com/klauspost/compress v1.15.1 github.com/kyoh86/exportloopref v0.1.8 + github.com/lestrrat-go/jwx/v2 v2.0.6 github.com/mgechev/revive v1.2.4 github.com/ngaut/pools v0.0.0-20180318154953-b7bc8c42aac7 github.com/nishanths/predeclared v0.2.2 @@ -106,12 +107,12 @@ require ( go.uber.org/multierr v1.8.0 go.uber.org/zap v1.23.0 golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e - golang.org/x/net v0.0.0-20220722155237-a158d28d115b + golang.org/x/net v0.1.0 golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5 golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 - golang.org/x/sys v0.0.0-20220928140112-f11e5e49a4ec - golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 - golang.org/x/text v0.3.7 + golang.org/x/sys v0.1.0 + golang.org/x/term v0.1.0 + golang.org/x/text v0.4.0 golang.org/x/time v0.0.0-20220224211638-0e9765cccd65 golang.org/x/tools v0.1.12 google.golang.org/api v0.74.0 @@ -147,6 +148,7 @@ require ( github.com/coreos/go-systemd/v22 v22.3.2 // indirect github.com/cznic/mathutil v0.0.0-20181122101859-297441e03548 // indirect github.com/davecgh/go-spew v1.1.1 // indirect + github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 // indirect github.com/dustin/go-humanize v1.0.0 // indirect github.com/eapache/go-resiliency v1.2.0 // indirect github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21 // indirect @@ -157,6 +159,7 @@ require ( github.com/go-kit/kit v0.9.0 // indirect github.com/go-logfmt/logfmt v0.5.1 // indirect github.com/go-ole/go-ole v1.2.6 // indirect + github.com/goccy/go-json v0.9.11 // indirect github.com/golang/glog v1.0.0 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/google/go-cmp v0.5.8 // indirect @@ -181,6 +184,11 @@ require ( github.com/klauspost/cpuid v1.3.1 // indirect github.com/kr/pretty v0.3.0 // indirect github.com/kr/text v0.2.0 // indirect + github.com/lestrrat-go/blackmagic v1.0.1 // indirect + github.com/lestrrat-go/httpcc v1.0.1 // indirect + github.com/lestrrat-go/httprc v1.0.4 // indirect + github.com/lestrrat-go/iter v1.0.2 // indirect + github.com/lestrrat-go/option v1.0.0 // indirect github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.16 // indirect @@ -228,7 +236,7 @@ require ( go.opentelemetry.io/otel/sdk/metric v0.20.0 // indirect go.opentelemetry.io/otel/trace v0.20.0 // indirect go.opentelemetry.io/proto/otlp v0.7.0 // indirect - golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4 // indirect + golang.org/x/crypto v0.1.0 // indirect golang.org/x/exp/typeparams v0.0.0-20220613132600-b0d781184e0d // indirect golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 // indirect golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f // indirect diff --git a/go.sum b/go.sum index 0b15dbe804918..deccee72b3f3d 100644 --- a/go.sum +++ b/go.sum @@ -227,6 +227,9 @@ github.com/danjacques/gofslock v0.0.0-20191023191349-0a45f885bc37/go.mod h1:DC3J github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn47hh8kt6rqSlvmrXFAc= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 h1:HbphB4TFFXpv7MNrT52FGrrgVXF1owhMVTHFZIlnvd4= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0/go.mod h1:DZGJHZMqrU4JJqFAWUS2UO1+lbSKsdiOoYi9Zzey7Fc= github.com/dgraph-io/badger v1.6.0/go.mod h1:zwt7syl517jmP8s94KqSxTlM6IMsdhYy6psNgSztDR4= github.com/dgraph-io/ristretto v0.1.1-0.20220403145359-8e850b710d6d h1:Wrc3UKTS+cffkOx0xRGFC+ZesNuTfn0ThvEC72N0krk= github.com/dgraph-io/ristretto v0.1.1-0.20220403145359-8e850b710d6d/go.mod h1:RAy2GVV4sTWVlNMavv3xhLsk18rxhfhDnombTe6EF5c= @@ -331,6 +334,8 @@ github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/me github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee/go.mod h1:L0fX3K22YWvt/FAX9NnzrNzcI4wNYi9Yku4O0LKYflo= github.com/gobwas/pool v0.2.0/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw= github.com/gobwas/ws v1.0.2/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/EM= +github.com/goccy/go-json v0.9.11 h1:/pAaQDLHEoCq/5FFmSKBswWmK6H0e8g4159Kc/X/nqk= +github.com/goccy/go-json v0.9.11/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/gogo/googleapis v0.0.0-20180223154316-0cd9801be74a/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s= github.com/gogo/protobuf v0.0.0-20171007142547-342cbe0a0415/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= @@ -627,6 +632,18 @@ github.com/kyoh86/exportloopref v0.1.8 h1:5Ry/at+eFdkX9Vsdw3qU4YkvGtzuVfzT4X7S77 github.com/kyoh86/exportloopref v0.1.8/go.mod h1:1tUcJeiioIs7VWe5gcOObrux3lb66+sBqGZrRkMwPgg= github.com/labstack/echo/v4 v4.1.11/go.mod h1:i541M3Fj6f76NZtHSj7TXnyM8n2gaodfvfxNnFqi74g= github.com/labstack/gommon v0.3.0/go.mod h1:MULnywXg0yavhxWKc+lOruYdAhDwPK9wf0OL7NoOu+k= +github.com/lestrrat-go/blackmagic v1.0.1 h1:lS5Zts+5HIC/8og6cGHb0uCcNCa3OUt1ygh3Qz2Fe80= +github.com/lestrrat-go/blackmagic v1.0.1/go.mod h1:UrEqBzIR2U6CnzVyUtfM6oZNMt/7O7Vohk2J0OGSAtU= +github.com/lestrrat-go/httpcc v1.0.1 h1:ydWCStUeJLkpYyjLDHihupbn2tYmZ7m22BGkcvZZrIE= +github.com/lestrrat-go/httpcc v1.0.1/go.mod h1:qiltp3Mt56+55GPVCbTdM9MlqhvzyuL6W/NMDA8vA5E= +github.com/lestrrat-go/httprc v1.0.4 h1:bAZymwoZQb+Oq8MEbyipag7iSq6YIga8Wj6GOiJGdI8= +github.com/lestrrat-go/httprc v1.0.4/go.mod h1:mwwz3JMTPBjHUkkDv/IGJ39aALInZLrhBp0X7KGUZlo= +github.com/lestrrat-go/iter v1.0.2 h1:gMXo1q4c2pHmC3dn8LzRhJfP1ceCbgSiT9lUydIzltI= +github.com/lestrrat-go/iter v1.0.2/go.mod h1:Momfcq3AnRlRjI5b5O8/G5/BvpzrhoFTZcn06fEOPt4= +github.com/lestrrat-go/jwx/v2 v2.0.6 h1:RlyYNLV892Ed7+FTfj1ROoF6x7WxL965PGTHso/60G0= +github.com/lestrrat-go/jwx/v2 v2.0.6/go.mod h1:aVrGuwEr3cp2Prw6TtQvr8sQxe+84gruID5C9TxT64Q= +github.com/lestrrat-go/option v1.0.0 h1:WqAWL8kh8VcSoD6xjSH34/1m8yxluXQbDeKNfvFeEO4= +github.com/lestrrat-go/option v1.0.0/go.mod h1:5ZHFbivi4xwXxhxY9XHDe2FHo6/Z7WWmtT7T5nBBp3I= github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lightstep/lightstep-tracer-go v0.15.6/go.mod h1:6AMpwZpsyCFwSovxzM78e+AsYxE8sGwiM6C3TytaWeI= github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 h1:6E+4a0GO5zZEnZ81pIr0yLvtUWk2if982qA3F3QD6H4= @@ -1058,8 +1075,9 @@ golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20201112155050-0c6587e931a9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4 h1:kUhD7nTDoI3fVd9G4ORWrbV5NY0liEs/Jg2pv5f+bBA= -golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.0.0-20220427172511-eb4f295cb31f/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.1.0 h1:MDRAIl0xIo9Io2xV565hzXHw3zVseKrJKodhohM5CjU= +golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -1162,11 +1180,12 @@ golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qx golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220325170049-de3da57026de/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.0.0-20220722155237-a158d28d115b h1:PxfKdU9lEEDYjdIzOtC4qFWgkU2rGHdKlKowJSMN9h0= -golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.1.0 h1:hZ/3BUoy5aId7sCpA/Tc5lt8DkFgdVS2onTpJsZ/fl0= +golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1290,11 +1309,12 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220909162455-aba9fc2a8ff2/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220928140112-f11e5e49a4ec h1:BkDtF2Ih9xZ7le9ndzTA7KJow28VbQW3odyk/8drmuI= -golang.org/x/sys v0.0.0-20220928140112-f11e5e49a4ec/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.1.0 h1:kunALQeHf1/185U1i0GOB/fy1IPRDDpuoOOqRReG57U= +golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 h1:JGgROgKl9N8DuW20oFS5gxc+lE67/N3FcwmBPMe7ArY= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.1.0 h1:g6Z6vPFA9dYBAF7DWcH6sCcOntplXsDKcliusYijMlw= +golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1303,8 +1323,9 @@ golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.4.0 h1:BrVqGRd7+k1DiOgtnFvAkoQEWQvBc25ouMJM6429SFg= +golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= diff --git a/infoschema/main_test.go b/infoschema/main_test.go index 9330b22b360ca..09a412679f664 100644 --- a/infoschema/main_test.go +++ b/infoschema/main_test.go @@ -25,6 +25,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"), } diff --git a/infoschema/perfschema/main_test.go b/infoschema/perfschema/main_test.go index 43012b2c4dbde..950b95993b536 100644 --- a/infoschema/perfschema/main_test.go +++ b/infoschema/perfschema/main_test.go @@ -25,6 +25,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"), } diff --git a/kv/main_test.go b/kv/main_test.go index e0b772c63768d..3d161d7ce0704 100644 --- a/kv/main_test.go +++ b/kv/main_test.go @@ -26,6 +26,7 @@ func TestMain(m *testing.M) { opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"), } diff --git a/meta/autoid/main_test.go b/meta/autoid/main_test.go index c5dad759b65b1..7eb312e043e3a 100644 --- a/meta/autoid/main_test.go +++ b/meta/autoid/main_test.go @@ -25,6 +25,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"), } diff --git a/meta/main_test.go b/meta/main_test.go index 1cfa29527043e..3e4abdaa12624 100644 --- a/meta/main_test.go +++ b/meta/main_test.go @@ -25,6 +25,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), } diff --git a/metrics/main_test.go b/metrics/main_test.go index 998921fbc3192..887847a12ba86 100644 --- a/metrics/main_test.go +++ b/metrics/main_test.go @@ -25,6 +25,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"), } diff --git a/owner/main_test.go b/owner/main_test.go index 57bc7021c5ca9..b1e1355258582 100644 --- a/owner/main_test.go +++ b/owner/main_test.go @@ -25,6 +25,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), } diff --git a/planner/cascades/main_test.go b/planner/cascades/main_test.go index c135838a2a1fb..8e3fb1f656b17 100644 --- a/planner/cascades/main_test.go +++ b/planner/cascades/main_test.go @@ -48,6 +48,7 @@ func TestMain(m *testing.M) { opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"), } diff --git a/planner/core/main_test.go b/planner/core/main_test.go index a6c646923cb30..8bd3264684fb7 100644 --- a/planner/core/main_test.go +++ b/planner/core/main_test.go @@ -56,6 +56,7 @@ func TestMain(m *testing.M) { opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), goleak.IgnoreTopFunction("gopkg.in/natefinch/lumberjack%2ev2.(*Logger).millRun"), goleak.IgnoreTopFunction("github.com/tikv/client-go/v2/txnkv/transaction.keepAlive"), diff --git a/planner/funcdep/main_test.go b/planner/funcdep/main_test.go index 4387fad57e5b8..6d95dd208e1b7 100644 --- a/planner/funcdep/main_test.go +++ b/planner/funcdep/main_test.go @@ -25,6 +25,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"), } diff --git a/planner/implementation/main_test.go b/planner/implementation/main_test.go index 4c2b1efb962ce..57f40ea9f20ac 100644 --- a/planner/implementation/main_test.go +++ b/planner/implementation/main_test.go @@ -25,6 +25,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), } goleak.VerifyTestMain(m, opts...) diff --git a/planner/memo/main_test.go b/planner/memo/main_test.go index bb84aa0af9800..28382d1c818ec 100644 --- a/planner/memo/main_test.go +++ b/planner/memo/main_test.go @@ -25,6 +25,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"), } diff --git a/planner/util/main_test.go b/planner/util/main_test.go index 1cb1f40846368..7f62901b5534c 100644 --- a/planner/util/main_test.go +++ b/planner/util/main_test.go @@ -25,6 +25,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"), } diff --git a/plugin/conn_ip_example/main_test.go b/plugin/conn_ip_example/main_test.go index 4847a1b134245..33e3beaa207d4 100644 --- a/plugin/conn_ip_example/main_test.go +++ b/plugin/conn_ip_example/main_test.go @@ -25,6 +25,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"), } diff --git a/plugin/main_test.go b/plugin/main_test.go index 6d55a790de4de..9c7fbeda0f42e 100644 --- a/plugin/main_test.go +++ b/plugin/main_test.go @@ -26,6 +26,7 @@ func TestMain(m *testing.M) { opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"), goleak.IgnoreTopFunction("time.Sleep"), diff --git a/privilege/privileges/BUILD.bazel b/privilege/privileges/BUILD.bazel index f9b2f021c488f..57ed2f9001afb 100644 --- a/privilege/privileges/BUILD.bazel +++ b/privilege/privileges/BUILD.bazel @@ -6,6 +6,7 @@ go_library( "cache.go", "errors.go", "privileges.go", + "tidb_auth_token.go", ], importpath = "github.com/pingcap/tidb/privilege/privileges", visibility = ["//visibility:public"], @@ -30,6 +31,10 @@ go_library( "//util/sem", "//util/sqlexec", "//util/stringutil", + "@com_github_lestrrat_go_jwx_v2//jwk", + "@com_github_lestrrat_go_jwx_v2//jws", + "@com_github_lestrrat_go_jwx_v2//jwt", + "@com_github_lestrrat_go_jwx_v2//jwt/openid", "@com_github_pingcap_errors//:errors", "@org_golang_x_exp//slices", "@org_uber_go_zap//:zap", @@ -43,11 +48,12 @@ go_test( "cache_test.go", "main_test.go", "privileges_test.go", + "tidb_auth_token_test.go", ], + embed = [":privileges"], flaky = True, shard_count = 50, deps = [ - ":privileges", "//config", "//errno", "//executor", @@ -64,8 +70,14 @@ go_test( "//testkit/testsetup", "//testkit/testutil", "//util", + "//util/hack", "//util/sem", "//util/sqlexec", + "@com_github_lestrrat_go_jwx_v2//jwa", + "@com_github_lestrrat_go_jwx_v2//jwk", + "@com_github_lestrrat_go_jwx_v2//jws", + "@com_github_lestrrat_go_jwx_v2//jwt", + "@com_github_lestrrat_go_jwx_v2//jwt/openid", "@com_github_stretchr_testify//require", "@org_uber_go_goleak//:goleak", ], diff --git a/privilege/privileges/cache.go b/privilege/privileges/cache.go index 0e377746acbc1..086231e4773a4 100644 --- a/privilege/privileges/cache.go +++ b/privilege/privileges/cache.go @@ -66,7 +66,7 @@ const ( References_priv,Alter_priv,Execute_priv,Index_priv,Create_view_priv,Show_view_priv, Create_role_priv,Drop_role_priv,Create_tmp_table_priv,Lock_tables_priv,Create_routine_priv, Alter_routine_priv,Event_priv,Shutdown_priv,Reload_priv,File_priv,Config_priv,Repl_client_priv,Repl_slave_priv, - account_locked,plugin,token_issuer FROM mysql.user` + Account_locked,Plugin,Token_issuer,User_attributes FROM mysql.user` sqlLoadGlobalGrantsTable = `SELECT HIGH_PRIORITY Host,User,Priv,With_Grant_Option FROM mysql.global_grants` ) @@ -101,6 +101,7 @@ type UserRecord struct { AccountLocked bool // A role record when this field is true AuthPlugin string AuthTokenIssuer string + Email string } // NewUserRecord return a UserRecord, only use for unit test. @@ -666,6 +667,22 @@ func (p *MySQLPrivilege) decodeUserTableRow(row chunk.Row, fs []*ast.ResultField value.Privileges |= priv case f.ColumnAsName.L == "token_issuer": value.AuthTokenIssuer = row.GetString(i) + case f.ColumnAsName.L == "user_attributes": + if row.IsNull(i) { + continue + } + bj := row.GetJSON(i) + pathExpr, err := types.ParseJSONPathExpr("$.metadata.email") + if err != nil { + return err + } + if emailBJ, found := bj.Extract([]types.JSONPathExpression{pathExpr}); found { + email, err := emailBJ.Unquote() + if err != nil { + return err + } + value.Email = email + } default: value.assignUserOrHost(row, i, f) } diff --git a/privilege/privileges/cache_test.go b/privilege/privileges/cache_test.go index 92f73163d456f..c611c80d99b16 100644 --- a/privilege/privileges/cache_test.go +++ b/privilege/privileges/cache_test.go @@ -42,6 +42,7 @@ func TestLoadUserTable(t *testing.T) { tk.MustExec(`INSERT INTO mysql.user (Host, User, authentication_string, Insert_priv) VALUES ("%", "root1", "admin", "Y")`) tk.MustExec(`INSERT INTO mysql.user (Host, User, authentication_string, Update_priv, Show_db_priv, References_priv) VALUES ("%", "root11", "", "Y", "Y", "Y")`) tk.MustExec(`INSERT INTO mysql.user (Host, User, authentication_string, Create_user_priv, Index_priv, Execute_priv, Create_view_priv, Show_view_priv, Show_db_priv, Super_priv, Trigger_priv) VALUES ("%", "root111", "", "Y", "Y", "Y", "Y", "Y", "Y", "Y", "Y")`) + tk.MustExec(`INSERT INTO mysql.user (Host, User, user_attributes, token_issuer) VALUES ("%", "root1111", "{\"metadata\": {\"email\": \"user@pingcap.com\"}}", "")`) p = privileges.MySQLPrivilege{} require.NoError(t, p.LoadUserTable(tk.Session())) @@ -53,6 +54,8 @@ func TestLoadUserTable(t *testing.T) { require.Equal(t, mysql.InsertPriv, user[1].Privileges) require.Equal(t, mysql.UpdatePriv|mysql.ShowDBPriv|mysql.ReferencesPriv, user[2].Privileges) require.Equal(t, mysql.CreateUserPriv|mysql.IndexPriv|mysql.ExecutePriv|mysql.CreateViewPriv|mysql.ShowViewPriv|mysql.ShowDBPriv|mysql.SuperPriv|mysql.TriggerPriv, user[3].Privileges) + require.Equal(t, "user@pingcap.com", user[4].Email) + require.Equal(t, "", user[4].AuthTokenIssuer) } func TestLoadGlobalPrivTable(t *testing.T) { @@ -411,9 +414,10 @@ func TestAbnormalMySQLTable(t *testing.T) { authentication_string text COLLATE utf8_bin, password_expired enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', token_issuer varchar(255), + user_attributes json, PRIMARY KEY (Host,User) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Users and global privileges';`) - tk.MustExec(`INSERT INTO user VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0,'mysql_native_password','','N', ''); + tk.MustExec(`INSERT INTO user VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0,'mysql_native_password','','N', '', 'null'); `) var p privileges.MySQLPrivilege require.NoError(t, p.LoadUserTable(tk.Session())) diff --git a/privilege/privileges/main_test.go b/privilege/privileges/main_test.go index efe96d5784161..f591389958fd5 100644 --- a/privilege/privileges/main_test.go +++ b/privilege/privileges/main_test.go @@ -25,10 +25,12 @@ import ( func TestMain(m *testing.M) { opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"), goleak.IgnoreTopFunction("net/http.(*persistConn).writeLoop"), goleak.IgnoreTopFunction("internal/poll.runtime_pollWait"), + goleak.IgnoreTopFunction("github.com/pingcap/tidb/privilege/privileges.(*JWKSImpl).LoadJWKS4AuthToken.func1"), } testsetup.SetupForCommonTest() diff --git a/privilege/privileges/privileges.go b/privilege/privileges/privileges.go index 90bfc80876f27..58be6097c2bc0 100644 --- a/privilege/privileges/privileges.go +++ b/privilege/privileges/privileges.go @@ -21,7 +21,10 @@ import ( "fmt" "strings" "sync" + "time" + jwtRepo "github.com/lestrrat-go/jwx/v2/jwt" + "github.com/lestrrat-go/jwx/v2/jwt/openid" "github.com/pingcap/tidb/extension" "github.com/pingcap/tidb/infoschema" "github.com/pingcap/tidb/parser/auth" @@ -30,6 +33,7 @@ import ( "github.com/pingcap/tidb/sessionctx" "github.com/pingcap/tidb/types" "github.com/pingcap/tidb/util" + "github.com/pingcap/tidb/util/hack" "github.com/pingcap/tidb/util/logutil" "github.com/pingcap/tidb/util/sem" "go.uber.org/zap" @@ -56,6 +60,7 @@ var dynamicPrivs = []string{ "RESTRICTED_REPLICA_WRITER_ADMIN", // Can write to the sever even when tidb_restriced_read_only is turned on. } var dynamicPrivLock sync.Mutex +var defaultTokenLife = 15 * time.Minute // UserPrivileges implements privilege.Manager interface. // This is used to check privilege for the current user. @@ -289,6 +294,49 @@ func (p *UserPrivileges) GetAuthWithoutVerification(user, host string) (success return } +func checkAuthTokenClaims(claims map[string]interface{}, record *UserRecord, tokenLife time.Duration) error { + if sub, ok := claims[jwtRepo.SubjectKey]; !ok { + return errors.New("lack 'sub'") + } else if sub != record.User { + return fmt.Errorf("Wrong 'sub': %s", sub) + } + + if email, ok := claims[openid.EmailKey]; !ok { + return errors.New("lack 'email'") + } else if email != record.Email { + return fmt.Errorf("Wrong 'email': %s", email) + } + + now := time.Now() + val, ok := claims[jwtRepo.IssuedAtKey] + if !ok { + return errors.New("lack 'iat'") + } else if iat, ok := val.(time.Time); !ok { + return fmt.Errorf("iat: %v is not a value of time.Time", val) + } else if now.After(iat.Add(tokenLife)) { + return errors.New("the token has been out of its life time") + } else if now.Before(iat) { + return errors.New("the token is issued at a future time") + } + + if val, ok = claims[jwtRepo.ExpirationKey]; !ok { + return errors.New("lack 'exp'") + } else if exp, ok := val.(time.Time); !ok { + return fmt.Errorf("exp: %v is not a value of time.Time", val) + } else if now.After(exp) { + return errors.New("the token has been expired") + } + + // `iss` is not required if `token_issuer` is empty in `mysql.user` + if iss, ok := claims[jwtRepo.IssuerKey]; ok && iss != record.AuthTokenIssuer { + return fmt.Errorf("Wrong 'iss': %s", iss) + } else if !ok && len(record.AuthTokenIssuer) > 0 { + return errors.New("lack 'iss'") + } + + return nil +} + // ConnectionVerification implements the Manager interface. func (p *UserPrivileges) ConnectionVerification(user *auth.UserIdentity, authUser, authHost string, authentication, salt []byte, tlsState *tls.ConnectionState) error { hasPassword := "YES" @@ -323,7 +371,25 @@ func (p *UserPrivileges) ConnectionVerification(user *auth.UserIdentity, authUse return ErrAccessDenied.FastGenByArgs(user.Username, user.Hostname, hasPassword) } - if len(pwd) > 0 && len(authentication) > 0 { + if record.AuthPlugin == mysql.AuthTiDBAuthToken { + if len(authentication) == 0 { + logutil.BgLogger().Error("empty authentication") + return ErrAccessDenied.FastGenByArgs(user.Username, user.Hostname, hasPassword) + } + tokenString := string(hack.String(authentication[:len(authentication)-1])) + var ( + claims map[string]interface{} + err error + ) + if claims, err = GlobalJWKS.checkSigWithRetry(tokenString, 1); err != nil { + logutil.BgLogger().Error("verify JWT failed", zap.Error(err)) + return ErrAccessDenied.FastGenByArgs(user.Username, user.Hostname, hasPassword) + } + if err = checkAuthTokenClaims(claims, record, defaultTokenLife); err != nil { + logutil.BgLogger().Error("check claims failed", zap.Error(err)) + return ErrAccessDenied.FastGenByArgs(user.Username, user.Hostname, hasPassword) + } + } else if len(pwd) > 0 && len(authentication) > 0 { switch record.AuthPlugin { case mysql.AuthNativePassword: hpwd, err := auth.DecodePassword(pwd) @@ -351,9 +417,6 @@ func (p *UserPrivileges) ConnectionVerification(user *auth.UserIdentity, authUse zap.String("authentication_string", pwd)) return ErrAccessDenied.FastGenByArgs(user.Username, user.Hostname, hasPassword) } - case mysql.AuthTiDBAuthToken: - logutil.BgLogger().Error("unimplemented tidb_auth_token ConnectionVerification") - return ErrAccessDenied.FastGenByArgs(user.Username, user.Hostname, hasPassword) default: logutil.BgLogger().Error("unknown authentication plugin", zap.String("authUser", authUser), zap.String("plugin", record.AuthPlugin)) return ErrAccessDenied.FastGenByArgs(user.Username, user.Hostname, hasPassword) diff --git a/privilege/privileges/tidb_auth_token.go b/privilege/privileges/tidb_auth_token.go new file mode 100644 index 0000000000000..db15f469f841c --- /dev/null +++ b/privilege/privileges/tidb_auth_token.go @@ -0,0 +1,117 @@ +// Copyright 2022 PingCAP, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package privileges + +import ( + "context" + "encoding/json" + "strings" + "sync" + "sync/atomic" + "time" + "unsafe" + + jwkRepo "github.com/lestrrat-go/jwx/v2/jwk" + jwsRepo "github.com/lestrrat-go/jwx/v2/jws" + jwtRepo "github.com/lestrrat-go/jwx/v2/jwt" + "github.com/pingcap/errors" + "github.com/pingcap/tidb/util/logutil" + "go.uber.org/zap" +) + +// JWKSImpl contains a JSON Web Key Set (JWKS), and a filepath that stores the JWKS +type JWKSImpl struct { + set unsafe.Pointer // *jwkRepo.Set + filepath string +} + +// GlobalJWKS is the global JWKS for tidb-server +var GlobalJWKS JWKSImpl + +func (jwks *JWKSImpl) load() error { + cur, err := jwkRepo.ReadFile(jwks.filepath) + if err == nil { + atomic.StorePointer(&jwks.set, unsafe.Pointer(&cur)) + } + return err +} + +func (jwks *JWKSImpl) verify(tokenBytes []byte) (payload []byte, err error) { + s := (*jwkRepo.Set)(atomic.LoadPointer(&jwks.set)) + if s == nil { + return nil, errors.New("No valid JWKS yet") + } + return jwsRepo.Verify(tokenBytes, jwsRepo.WithKeySet(*s)) +} + +// LoadJWKS4AuthToken reload the jwks every auth-token-refresh-interval. +func (jwks *JWKSImpl) LoadJWKS4AuthToken(ctx context.Context, wg *sync.WaitGroup, jwksPath string, interval time.Duration) error { + jwks.filepath = jwksPath + if ctx != nil && wg != nil { + go func() { + ticker := time.Tick(interval) + wg.Add(1) + for { + select { + case <-ctx.Done(): + wg.Done() + return + case <-ticker: + } + if err := jwks.load(); err != nil { + logutil.BgLogger().Error("Fail to load JWKS", zap.String("path", jwksPath), zap.Duration("interval", interval)) + } + } + }() + } + return jwks.load() +} + +// checkSigWithRetry verifies the signature in the jwt, and returns the claims. +func (jwks *JWKSImpl) checkSigWithRetry(tokenString string, retryTime int) (map[string]interface{}, error) { + var ( + verifiedPayload []byte + err error + ) + parts := strings.Split(tokenString, ".") + if len(parts) != 3 { + err = errors.New("Invalid JWT") + return nil, err + } + for retryTime >= 0 { + retryTime-- + + // verify signature + verifiedPayload, err = jwks.verify(([]byte)(tokenString)) + if err != nil { + if err1 := jwks.load(); err1 != nil { + return nil, err1 + } + continue + } + + jwt := jwtRepo.New() + if err = jwt.(json.Unmarshaler).UnmarshalJSON(verifiedPayload); err != nil { + continue + } + claims, err := jwt.AsMap(context.Background()) + if err != nil { + continue + } + return claims, nil + } + err = errors.Annotate(err, "Retry time has been spent out") + return nil, err +} diff --git a/privilege/privileges/tidb_auth_token_test.go b/privilege/privileges/tidb_auth_token_test.go new file mode 100644 index 0000000000000..a1ee4b2fb33a0 --- /dev/null +++ b/privilege/privileges/tidb_auth_token_test.go @@ -0,0 +1,410 @@ +// Copyright 2022 PingCAP, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package privileges + +import ( + "crypto/rsa" + "encoding/json" + "fmt" + "log" + "os" + "strings" + "testing" + "time" + + jwaRepo "github.com/lestrrat-go/jwx/v2/jwa" + jwkRepo "github.com/lestrrat-go/jwx/v2/jwk" + jwsRepo "github.com/lestrrat-go/jwx/v2/jws" + jwtRepo "github.com/lestrrat-go/jwx/v2/jwt" + "github.com/lestrrat-go/jwx/v2/jwt/openid" + "github.com/pingcap/tidb/util/hack" + "github.com/stretchr/testify/require" +) + +var ( + privateKeyStrings = []string{`-----BEGIN RSA PRIVATE KEY----- +MIIEpAIBAAKCAQEAq8G5n9XBidxmBMVJKLOBsmdOHrCqGf17y9+VUXingwDUZxRp +2XbuLZLbJtLgcln1lC0L9BsogrWf7+pDhAzWovO6Ai4Aybu00tJ2u0g4j1aLiDds +y0gyvSb5FBoL08jFIH7t/JzMt4JpF487AjzvITwZZcnsrB9a9sdn2E5B/aZmpDGi +2+Isf5osnlw0zvveTwiMo9ba416VIzjntAVEvqMFHK7vyHqXbfqUPAyhjLO+iee9 +9Tg5AlGfjo1s6FjeML4xX7sAMGEy8FVBWNfpRU7ryTWoSn2adzyA/FVmtBvJNQBC +MrrAhXDTMJ5FNi8zHhvzyBKHU0kBTS1UNUbP9wIDAQABAoIBAFF0sbz82imwje2L +RvP3lfXvClyBulpTHigFJEKcLw1xEkrEoqKQxcp1UFvsPKfexBn+9yFQ0/iRfIWC +m3x/vjdP0ZKBELybudkWGVsemDxadhgm+QC7f9y3I/+FjsBlAiA0MlfQYUJSpdaX +hgu8rEgdwYnFpunGgRRyY2xxSNirEAzA6aTa1PkNU6W7nF5trOUOfdUSNZuPsS4y +rQjZJZDxB4SW+biuTqNAOKPPnnFY3PdntQx9uhcSm+qiDP2yQXoXuDK/TAN4euOK +vR5POnnDNKhFizGnR8xjW8GSmfg9ILxw/BpNFoIkvZo5xLtt7lNM2VPJaLzXEse2 +axOpKckCgYEA2g8GWQOmqH8M4LaOxZcy+4dvoOou4vv+V5Bn4TDtmRaQd40BqfOZ +jyi9sci7iGYVsHdSpLlLFcXedx97QKstJZZ8RKQZv/wBZ7JH6Hn80ipGnJ3a7S9+ +JY99iVDF6hOroR2fbnrqa/Dx8pPdMy9ZOXZvh3Q527j8u4m9zXUXfVUCgYEAyaRG +dSEt/AJxoecZqa450H8rlOQVDC0DcQcxGlEP7L2wQRinnJkfZ6+r7jhfu4SikOZO +MdXDF/ILGxSXw6+0xHwq9XfSlNhgTTcBNZOYfchMi6mvUxe/r4TsMXEcbRPSsuWo +EZJ1oZLHxdw9B96R9blnxk54VvILG60rrwbaOBsCgYEAz8EQ4y4/Urn5ov9L96We +xVa8XCvCkDBWm0bSMhNTzE9bRQvrUejtnR/L297MDaB1ebO14YtIpm3nDsfHvk1Y +rj86FovinK+VBx8ss6nF3ta4f+9F7kUZgt+7U2DJr8Md+lsm0zP4tO7TFbMbRPEP +qVfV2tA5b8ZHxMXvOBkfUCECgYAZbFvx0rAgkRJQrnme2jex4QbWq/c3ZMmFS7nW +LphKahQ58OjZJrk98nlD/NmdI/j3OgJr6B7D+yGJVYxZAONSzrD/6A6l864YrjG5 +1pUobsOv7EINwPXLJIA/L5q86f3rzmblaEjqiT4k5ULQpjBTAgBikWw80iGyaKAU +XlHPNwKBgQDC45gv8aRxJXwSjpCXHnnzoWAJHBOXIpTbQOVdGbuMRr5RAh4CVFsp +6rnNlannpnE8EMkLtAmPLNqmsP0XCRo2TpHU86PRO3OGH/3KEtU/X3ij9sts2OlM +03m9HNt6/h9glwk7NYwbGgOlKhRxr/DUTkumu0tdfYN+tLU83mBeNw== +-----END RSA PRIVATE KEY-----`, `-----BEGIN RSA PRIVATE KEY----- +MIIEpAIBAAKCAQEAywV8/DH1vLyuTOu9MBiAF2DLlZi0SOMEUznXVSRbt0+YVfsr +o67+66B7ATnB2a5BCyOGaFJ9aIwfTWILMTJo91hVk4gHdvsSYeiS3gnSQtKYEdAX +ZgL2apGP1s08XQfluTF57fxVn8RpKieox6Ea68JSGMuh0AEr2MuJzaTcxzQ5UpIi +K2vUuBXNMzZwbZKvssfsyoZ6zIEeco4BCGXXmJUyxFb6MLV8DWKwmUQjhV/EjDem +vE0vrUziY1afo2J9Ngk03mPHqprDZEa8u2wwtm2ghuCaislKh9X7vl31Yj5lcPCU +iacBupV6/bhMjPTAgIAOEcsLVZMK2P+snREDjwIDAQABAoIBACiu/93V8SWSNeeK +Mg5KSpjkt8dRo4cbnwlChQk10P9J/v/z5knVzpXPQfb76QHDLpuZ0dxj82eY9Mjg +Bdgk/u3aEMQQtVY9d/CQ16WRGEZ1xy2Cor25iEHQy59C337RD1LuPD3ZnBr5FA3z +hpoCic+G0EbRv6pcIbo/B21jRS7Rx+w13CNZQD1fL5vEc1CTR+WL/DeCTugGcj8i +wiaUb6eu2Z4YFoJqCWGhTfz1HL4i+y12HfAlezfYae9Lhm0r/mLMos6O7gHWqW24 +EbmeQZy+TGjd7SBw1wsEv7ZO+MFsfvbBvZidmK/FcxUqiyfsvhsTuRbgv6+GiMep +rF+acgkCgYEA6C7dg6GtBydIGq1iE7ty2pUcW4YPL2BVjTK7Fntt1ToVzUKZAulG +Av0+kukeReDLGxrNMhHDzGuLboA2v/PNcMnoJWnzg2+tMByyLWEvIvp9fngbSwRr +JEdDbUDQZbpEkyEC8fDAO3l3EmoHaGBEshZ0tDl0fui36vM1w8lhZDUCgYEA39jW +bsHHny4QUwwsXu/dvg8meYP2rCjBxjM7PIz1FKut+oftUmYCVhRvhZl5ydpO9/2f +VQYqHnDMlmAzjCovKvjFFMXJl2QucUHR+S94sobmTj6tfY9VzAq8uZaMi9jq5uRL +WZvmTPtj3U7KequCqCN7w14o7JkFxOGquFy5eTMCgYANr42BD8uaK1eVsvif/yGS +/s0QHAPTIBOK4h2jAp2Dvwu/8JgCUuu8i17f2/vb1JdEPr0voVpwNzqdxdL0V5OZ +fV1Ar1EaQz/rIRXjlOHpZuh0xvGc52LFXan8y6A9DtCx93Ur+6vpFYzOOg+7uEj0 +UlyIrwZN4LvOjo1xv/IMrQKBgQCfsFAhSUqAa1sn87o/q/zTlnlLHPI/lP/PxkKP +CrvYGDWQUaHjM3SdNgztETUJ5ByL27nr7O7lMnExIcYESx/FFx15mTQcNVLQZzVF +ADGpooTv8tTPiw6Y9lv2RclUBtZlCx4Z+hbMelaezZOy+WHHUzD6idTGHNA5yQeC +aFvEcwKBgQC+QzEkoG7IDqrFL62x+H607juYF4IY4kXo7zsrfY4uWffC7Mf5XaYs +qkX9+ouK/CROAKO+UdMEs8PWHF1CHmgV3t/EF2+xfkGvVr/RlgtMHgQe8lX9a+sK +1xpqDpqmXTST37cy+lQGPXmWrJsTulWQj0F1LV4i4qt7Ph4JK4kzvA== +-----END RSA PRIVATE KEY----- +`, `-----BEGIN RSA PRIVATE KEY----- +MIIEowIBAAKCAQEAoaJsIxrUBKPW/dogPpUxxhiL8cpUt8uWlclOrmUSHFZzY50r +wsCt2ndnZRHE/HD+X7oCo28pdYTySZWnsiY/K2HeyYdsRzUH71Mx0Z+a1uBa0k6B +VHY8vrPObLCPFEmxnqml+Wj74zocsR23/puCz8Vgm+0VF49vu+ab90lc2iLJtElv +eRnLrSkaudCUndmn+aVftwnpDxJ4Z0rRlJkhyeZMN4+EMse5+0hAhg5UiPHE6pG8 +RI3zYnp0EYKvN+M9/cdNntyuKCCCvOCi4b4d4wpGOrDuiA/moh2J9zwPBMiyvIFo +zUMmqAQV3zuUxx+jAAjrc9ReQLnoExhuhfrU5wIDAQABAoIBAC62PgI3MqbUosFi +VIdBnszdMzSBgNJNKAvJzc9grkc6RMa5GXiDLrtAXsU6yW8bSKhpnXGWIqkv7sWN +VpWJsB/dfQFI/eXmUZC8vl0SfzEyTY0R2xaJxSxn0nRe4jq+wXJVHP5jdMhKdxhI +um/+iWN6a10kuz+/2E65asGglhEEHxzm9ux9PGbhOR7NVAiReRfEKN0UgmD9jWHL +nR2uBsS3BsPBURKBERzYOqGmxMgOq9Y07Jf6d4Ln33SfkKsD/ibTPoUyTsvwG0g1 +J7wVmqZRxG7GLGxLjjs+s16LWjRKUCbHOf7VIMKkYj2HBgzMZOG6/f579mejB//D +K5rSwuECgYEA0doT9iTVq9ZbpYKfLH5HzqoTuZeP5Q5acO2ZM2Bat6Xdk/ZgOgh4 +Gvzgfi33kl03Pp2ZhQX9m1k1eicTcDPvNQZ3JeTI7bgO3ZQXt8PkCL/pPCZyfusB +C9sP4zhhmieLuX7SZmkWpJvy1XtjvJsyhnnZz2s51nvCKKAe6JVFatUCgYEAxS3f +yFOBzRAyuPWUF4pGTAVfysM47Zl0alDcZgM30ARhqhsfHOo26xeU6TEWucCh30fS +tehXlQDlygHN1+CxkqH6mv0Nlp1j/1YV9mZIEZ++jIggAgsit29YtoQMIe6/lv0+ ++aivyNJrCtbgm9ZA4+OOie3Cvjf/6qnqnBSFpssCgYBWkfyCIpfzF68fDE/V7xJ4 +czlH6vp1qAIvbBUzWKCT+lz6WT1BM5U4rPF/nD7xpnrP3fwjIGGK4LZq+gvO0d3w +pgYpH8S0LKYVSq6uJKXB5km1grbhHNmFpo1bUzsQeRfvIh5yGRA6QAthflGa0Pt6 +9nGgW7+0d8GVONkHYe0NMQKBgAJU64uL6UIKif8D8G9i1Df77EkSi+7LXMQRFroi +GZvdIWaIkZKe9m1LRxiG2xTxQTjJuaUrDTYW36DG6q892fu47KS+j1WToOYZF4Nl +bD7BG9i/l1lO1mdC6tKltxsDnsJjVkZPh1yhmGB1cAyHuRa4zyu0YxQqx1z4C20z +FO2HAoGBALp9nGqbK6N96LYgef8GpP6o5pz3D1Jtj18iYyn3oz6z9t3dqNbpf2vh +cYnDqCQWSX5rfDRMbuhEJB+GvHYKVY/yVJ2ZWu1cKsB+2gzsITWewfxTS/ns+4Qk +RfViImdNIa19f7cmeC8RjhaSWBmb9JJk+p75e4XpgD1bG9U7DjiH +-----END RSA PRIVATE KEY----- +`} + + publicKeyStrings = []string{`-----BEGIN PUBLIC KEY----- +MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAq8G5n9XBidxmBMVJKLOB +smdOHrCqGf17y9+VUXingwDUZxRp2XbuLZLbJtLgcln1lC0L9BsogrWf7+pDhAzW +ovO6Ai4Aybu00tJ2u0g4j1aLiDdsy0gyvSb5FBoL08jFIH7t/JzMt4JpF487Ajzv +ITwZZcnsrB9a9sdn2E5B/aZmpDGi2+Isf5osnlw0zvveTwiMo9ba416VIzjntAVE +vqMFHK7vyHqXbfqUPAyhjLO+iee99Tg5AlGfjo1s6FjeML4xX7sAMGEy8FVBWNfp +RU7ryTWoSn2adzyA/FVmtBvJNQBCMrrAhXDTMJ5FNi8zHhvzyBKHU0kBTS1UNUbP +9wIDAQAB +-----END PUBLIC KEY-----`, `-----BEGIN PUBLIC KEY----- +MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAywV8/DH1vLyuTOu9MBiA +F2DLlZi0SOMEUznXVSRbt0+YVfsro67+66B7ATnB2a5BCyOGaFJ9aIwfTWILMTJo +91hVk4gHdvsSYeiS3gnSQtKYEdAXZgL2apGP1s08XQfluTF57fxVn8RpKieox6Ea +68JSGMuh0AEr2MuJzaTcxzQ5UpIiK2vUuBXNMzZwbZKvssfsyoZ6zIEeco4BCGXX +mJUyxFb6MLV8DWKwmUQjhV/EjDemvE0vrUziY1afo2J9Ngk03mPHqprDZEa8u2ww +tm2ghuCaislKh9X7vl31Yj5lcPCUiacBupV6/bhMjPTAgIAOEcsLVZMK2P+snRED +jwIDAQAB +-----END PUBLIC KEY-----`, `-----BEGIN PUBLIC KEY----- +MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAoaJsIxrUBKPW/dogPpUx +xhiL8cpUt8uWlclOrmUSHFZzY50rwsCt2ndnZRHE/HD+X7oCo28pdYTySZWnsiY/ +K2HeyYdsRzUH71Mx0Z+a1uBa0k6BVHY8vrPObLCPFEmxnqml+Wj74zocsR23/puC +z8Vgm+0VF49vu+ab90lc2iLJtElveRnLrSkaudCUndmn+aVftwnpDxJ4Z0rRlJkh +yeZMN4+EMse5+0hAhg5UiPHE6pG8RI3zYnp0EYKvN+M9/cdNntyuKCCCvOCi4b4d +4wpGOrDuiA/moh2J9zwPBMiyvIFozUMmqAQV3zuUxx+jAAjrc9ReQLnoExhuhfrU +5wIDAQAB +-----END PUBLIC KEY-----`} + + priKeys []*rsa.PrivateKey + pubKeys []*rsa.PublicKey + jwkArray []jwkRepo.Key + path [3]string // path[0] contains jwkArray[0], path[1] contains jwkArray[0:2], path[2] contains jwkArray[2] + + email1 = "user1@pingcap.com" + email2 = "user2@pingcap.com" + issuer1 = "issuer1" + issuer2 = "issuer2" +) + +type pair struct { + name string + value interface{} +} + +func init() { + for i := range publicKeyStrings { + if v, rest, err := jwkRepo.DecodePEM(([]byte)(privateKeyStrings[i])); err != nil { + log.Println(err.Error()) + log.Fatal("Error in decode private key") + } else if len(rest) > 0 { + log.Fatal("Rest in decode private key") + } else if priKey, ok := v.(*rsa.PrivateKey); !ok { + log.Fatal("Wrong type of private key") + } else { + priKeys = append(priKeys, priKey) + } + if v, rest, err := jwkRepo.DecodePEM(([]byte)(publicKeyStrings[i])); err != nil { + log.Println(err.Error()) + log.Fatal("Error in decode public key") + } else if len(rest) > 0 { + log.Fatal("Rest in decode public key") + } else if pubKey, ok := v.(*rsa.PublicKey); !ok { + log.Fatal("Wrong type of public key") + } else { + pubKeys = append(pubKeys, pubKey) + jwk, err := jwkRepo.FromRaw(pubKey) + if err != nil { + log.Fatal("Error when generate jwk") + } + keyAttributes := []pair{ + {jwkRepo.AlgorithmKey, jwaRepo.RS256}, + {jwkRepo.KeyIDKey, fmt.Sprintf("the-key-id-%d", i)}, + {jwkRepo.KeyUsageKey, "sig"}, + } + for _, keyAttribute := range keyAttributes { + if err = jwk.Set(keyAttribute.name, keyAttribute.value); err != nil { + log.Println(err.Error()) + log.Fatalf("Error when set %s for key %d", keyAttribute.name, i) + } + } + jwkArray = append(jwkArray, jwk) + } + } + + for i := range path { + path[i] = fmt.Sprintf("%s%cjwks%d.json", os.TempDir(), os.PathSeparator, i) + file, err := os.Create(path[i]) + if err != nil { + log.Fatal("Fail to create temp file") + } + jwks := jwkRepo.NewSet() + var rawJSON []byte + if i == 2 { + jwks.AddKey(jwkArray[i]) + } else { + for j := 0; j <= i; j++ { + jwks.AddKey(jwkArray[j]) + } + } + if rawJSON, err = json.MarshalIndent(jwks, "", " "); err != nil { + log.Fatal("Error when marshaler json") + } + if n, err := file.Write(rawJSON); err != nil { + log.Fatal("Error when writing json") + } else if n != len(rawJSON) { + log.Fatal("Lack byte when writing json") + } + } +} + +func getSignedTokenString(priKey *rsa.PrivateKey, pairs map[string]interface{}) (string, error) { + jwt := jwtRepo.New() + header := jwsRepo.NewHeaders() + headerPairs := []pair{ + {jwsRepo.AlgorithmKey, jwaRepo.RS256}, + {jwsRepo.TypeKey, "JWT"}, + } + for _, pair := range headerPairs { + if err := header.Set(pair.name, pair.value); err != nil { + log.Fatal("Error when set header") + } + } + for k, v := range pairs { + switch k { + case jwsRepo.KeyIDKey: + if err := header.Set(k, v); err != nil { + log.Fatal("Error when set header") + } + case jwtRepo.SubjectKey, jwtRepo.IssuedAtKey, jwtRepo.ExpirationKey, jwtRepo.IssuerKey, openid.EmailKey: + if err := jwt.Set(k, v); err != nil { + log.Fatal("Error when set payload") + } + } + } + bytes, err := jwtRepo.Sign(jwt, jwtRepo.WithKey(jwaRepo.RS256, priKey, jwsRepo.WithProtectedHeaders(header))) + if err != nil { + return "", err + } + return string(hack.String(bytes)), nil +} + +func TestAuthTokenClaims(t *testing.T) { + var jwksImpl JWKSImpl + now := time.Now() + require.NoError(t, jwksImpl.LoadJWKS4AuthToken(nil, nil, path[0], time.Hour), path[0]) + claims := map[string]interface{}{ + jwsRepo.KeyIDKey: "the-key-id-0", + jwtRepo.SubjectKey: email1, + openid.EmailKey: email1, + jwtRepo.IssuedAtKey: now.Unix(), + jwtRepo.ExpirationKey: now.Add(100 * time.Hour).Unix(), + jwtRepo.IssuerKey: issuer1, + } + signedTokenString, err := getSignedTokenString(priKeys[0], claims) + require.NoError(t, err) + verifiedClaims, err := jwksImpl.checkSigWithRetry(signedTokenString, 0) + require.NoError(t, err) + for k, v := range claims { + switch k { + case jwtRepo.SubjectKey, openid.EmailKey, jwtRepo.IssuerKey: + require.Equal(t, v, verifiedClaims[k]) + case jwtRepo.IssuedAtKey, jwtRepo.ExpirationKey: + require.Equal(t, v, verifiedClaims[k].(time.Time).Unix()) + } + } + record := &UserRecord{ + baseRecord: baseRecord{ + User: email1, + }, + AuthTokenIssuer: issuer1, + Email: email1, + } + + // Success + err = checkAuthTokenClaims(verifiedClaims, record, defaultTokenLife) + require.NoError(t, err) + + // test 'sub' + verifiedClaims[jwtRepo.SubjectKey] = email2 + err = checkAuthTokenClaims(verifiedClaims, record, defaultTokenLife) + require.ErrorContains(t, err, "Wrong 'sub'") + delete(verifiedClaims, jwtRepo.SubjectKey) + err = checkAuthTokenClaims(verifiedClaims, record, defaultTokenLife) + require.ErrorContains(t, err, "lack 'sub'") + verifiedClaims[jwtRepo.SubjectKey] = email1 + + // test 'email' + verifiedClaims[openid.EmailKey] = email2 + err = checkAuthTokenClaims(verifiedClaims, record, defaultTokenLife) + require.ErrorContains(t, err, "Wrong 'email'") + delete(verifiedClaims, openid.EmailKey) + err = checkAuthTokenClaims(verifiedClaims, record, defaultTokenLife) + require.ErrorContains(t, err, "lack 'email'") + verifiedClaims[openid.EmailKey] = email1 + + // test 'iat' + delete(verifiedClaims, jwtRepo.IssuedAtKey) + err = checkAuthTokenClaims(verifiedClaims, record, defaultTokenLife) + require.ErrorContains(t, err, "lack 'iat'") + verifiedClaims[jwtRepo.IssuedAtKey] = "abc" + err = checkAuthTokenClaims(verifiedClaims, record, defaultTokenLife) + require.ErrorContains(t, err, "iat: abc is not a value of time.Time") + time.Sleep(2 * time.Second) + verifiedClaims[jwtRepo.IssuedAtKey] = now + err = checkAuthTokenClaims(verifiedClaims, record, time.Second) + require.ErrorContains(t, err, "the token has been out of its life time") + verifiedClaims[jwtRepo.IssuedAtKey] = now.Add(time.Hour) + err = checkAuthTokenClaims(verifiedClaims, record, defaultTokenLife) + require.ErrorContains(t, err, "the token is issued at a future time") + verifiedClaims[jwtRepo.IssuedAtKey] = now + + // test 'exp' + delete(verifiedClaims, jwtRepo.ExpirationKey) + err = checkAuthTokenClaims(verifiedClaims, record, defaultTokenLife) + require.ErrorContains(t, err, "lack 'exp'") + verifiedClaims[jwtRepo.ExpirationKey] = "abc" + err = checkAuthTokenClaims(verifiedClaims, record, defaultTokenLife) + require.ErrorContains(t, err, "exp: abc is not a value of time.Time") + verifiedClaims[jwtRepo.ExpirationKey] = now + err = checkAuthTokenClaims(verifiedClaims, record, defaultTokenLife) + require.ErrorContains(t, err, "the token has been expired") + verifiedClaims[jwtRepo.ExpirationKey] = now.Add(100 * time.Hour) + + // test token_issuer + delete(verifiedClaims, jwtRepo.IssuerKey) + err = checkAuthTokenClaims(verifiedClaims, record, defaultTokenLife) + require.ErrorContains(t, err, "lack 'iss'") + verifiedClaims[jwtRepo.IssuerKey] = issuer1 + record.AuthTokenIssuer = issuer2 + err = checkAuthTokenClaims(verifiedClaims, record, defaultTokenLife) + require.ErrorContains(t, err, "Wrong 'iss") +} + +func TestJWKSImpl(t *testing.T) { + var jwksImpl JWKSImpl + + // Set wrong path of JWKS + require.Error(t, jwksImpl.LoadJWKS4AuthToken(nil, nil, "wrong-jwks-path", time.Hour)) + require.Error(t, jwksImpl.load()) + _, err := jwksImpl.checkSigWithRetry("invalid tokenString", 4) + require.Error(t, err) + _, err = jwksImpl.verify(([]byte)("invalid tokenString")) + require.Error(t, err) + + require.NoError(t, jwksImpl.LoadJWKS4AuthToken(nil, nil, path[0], time.Hour), path[0]) + now := time.Now() + claims := map[string]interface{}{ + jwsRepo.KeyIDKey: "the-key-id-0", + jwtRepo.SubjectKey: email1, + openid.EmailKey: email1, + jwtRepo.IssuedAtKey: now.Unix(), + jwtRepo.ExpirationKey: now.Add(100 * time.Hour).Unix(), + jwtRepo.IssuerKey: issuer1, + } + signedTokenString, err := getSignedTokenString(priKeys[0], claims) + require.NoError(t, err) + parts := strings.Split(signedTokenString, ".") + + // Wrong encoded JWT format + _, err = jwksImpl.checkSigWithRetry(parts[0]+"."+parts[1], 0) + require.ErrorContains(t, err, "Invalid JWT") + _, err = jwksImpl.checkSigWithRetry(signedTokenString+"."+parts[1], 0) + require.ErrorContains(t, err, "Invalid JWT") + + // Wrong signature + _, err = jwksImpl.checkSigWithRetry(signedTokenString+"A", 0) + require.ErrorContains(t, err, "could not verify message using any of the signatures or keys") + + // Wrong signature, and fail to reload JWKS + jwksImpl.filepath = "wrong-path" + _, err = jwksImpl.checkSigWithRetry(signedTokenString+"A", 0) + require.ErrorContains(t, err, "open wrong-path: no such file or directory") + jwksImpl.filepath = path[0] + + require.NoError(t, jwksImpl.LoadJWKS4AuthToken(nil, nil, path[0], time.Hour), path[0]) + _, err = jwksImpl.checkSigWithRetry(signedTokenString, 0) + require.NoError(t, err) + + // Wrong kid + claims[jwsRepo.KeyIDKey] = "the-key-id-1" + signedTokenString, err = getSignedTokenString(priKeys[0], claims) + require.NoError(t, err) + _, err = jwksImpl.checkSigWithRetry(signedTokenString, 0) + require.Error(t, err) + claims[jwsRepo.KeyIDKey] = "the-key-id-0" + signedTokenString, err = getSignedTokenString(priKeys[0], claims) + require.NoError(t, err) + require.NoError(t, jwksImpl.LoadJWKS4AuthToken(nil, nil, path[1], time.Hour), path[1]) + _, err = jwksImpl.checkSigWithRetry(signedTokenString, 0) + require.NoError(t, err) + require.NoError(t, jwksImpl.LoadJWKS4AuthToken(nil, nil, path[2], time.Hour), path[2]) + _, err = jwksImpl.checkSigWithRetry(signedTokenString, 0) + require.Error(t, err) +} diff --git a/server/conn.go b/server/conn.go index 8fdd6785b4c2b..4912ab030a927 100644 --- a/server/conn.go +++ b/server/conn.go @@ -682,6 +682,7 @@ func (cc *clientConn) readOptionalSSLRequestAndHandshakeResponse(ctx context.Con case mysql.AuthSocket: case mysql.AuthTiDBSessionToken: case mysql.AuthTiDBAuthToken: + case mysql.AuthMySQLClearPassword: default: return errors.New("Unknown auth plugin") } @@ -710,7 +711,7 @@ func (cc *clientConn) handleAuthPlugin(ctx context.Context, resp *handshakeRespo case mysql.AuthNativePassword: case mysql.AuthSocket: case mysql.AuthTiDBSessionToken: - case mysql.AuthTiDBAuthToken: + case mysql.AuthMySQLClearPassword: default: logutil.Logger(ctx).Warn("Unknown Auth Plugin", zap.String("plugin", resp.AuthPlugin)) } @@ -927,6 +928,9 @@ func (cc *clientConn) checkAuthPlugin(ctx context.Context, resp *handshakeRespon // method send by the client (*authPlugin) then we need to switch the authentication // method to match the one configured for that specific user. if (cc.authPlugin != userplugin) || (cc.authPlugin != resp.AuthPlugin) { + if userplugin == mysql.AuthTiDBAuthToken { + userplugin = mysql.AuthMySQLClearPassword + } if resp.Capability&mysql.ClientPluginAuth > 0 { authData, err := cc.authSwitchRequest(ctx, userplugin) if err != nil { diff --git a/server/main_test.go b/server/main_test.go index bff47f0dd7706..cdf12551934db 100644 --- a/server/main_test.go +++ b/server/main_test.go @@ -58,6 +58,7 @@ func TestMain(m *testing.M) { opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("time.Sleep"), goleak.IgnoreTopFunction("database/sql.(*Tx).awaitDone"), goleak.IgnoreTopFunction("internal/poll.runtime_pollWait"), diff --git a/server/server.go b/server/server.go index eb1f3d6ec951d..9b2bf6541e8e9 100644 --- a/server/server.go +++ b/server/server.go @@ -61,6 +61,7 @@ import ( "github.com/pingcap/tidb/parser/terror" "github.com/pingcap/tidb/planner/core" "github.com/pingcap/tidb/plugin" + "github.com/pingcap/tidb/privilege/privileges" "github.com/pingcap/tidb/session" "github.com/pingcap/tidb/session/txninfo" "github.com/pingcap/tidb/sessionctx/variable" @@ -139,9 +140,11 @@ type Server struct { grpcServer *grpc.Server inShutdownMode bool - sessionMapMutex sync.Mutex - internalSessions map[interface{}]struct{} - autoIDService *autoid.Service + sessionMapMutex sync.Mutex + internalSessions map[interface{}]struct{} + autoIDService *autoid.Service + authTokenCancelFunc context.CancelFunc + wg sync.WaitGroup } // ConnectionCount gets current connection count. @@ -303,6 +306,24 @@ func NewServer(cfg *config.Config, driver IDriver) (*Server, error) { } } + // Automatically reload JWKS for tidb_auth_token. + if len(s.cfg.Security.AuthTokenJWKS) > 0 { + var ( + timeInterval time.Duration + err error + ctx context.Context + ) + if timeInterval, err = time.ParseDuration(s.cfg.Security.AuthTokenRefreshInterval); err != nil { + logutil.BgLogger().Error("Fail to parse security.auth-token-refresh-interval. Use default value", + zap.String("security.auth-token-refresh-interval", s.cfg.Security.AuthTokenRefreshInterval)) + timeInterval = config.DefAuthTokenRefreshInterval + } + ctx, s.authTokenCancelFunc = context.WithCancel(context.Background()) + if err = privileges.GlobalJWKS.LoadJWKS4AuthToken(ctx, &s.wg, s.cfg.Security.AuthTokenJWKS, timeInterval); err != nil { + logutil.BgLogger().Error("Fail to load JWKS from the path", zap.String("jwks", s.cfg.Security.AuthTokenJWKS)) + } + } + // Init rand seed for randomBuf() rand.Seed(time.Now().UTC().UnixNano()) @@ -503,6 +524,10 @@ func (s *Server) Close() { if s.autoIDService != nil { s.autoIDService.Close() } + if s.authTokenCancelFunc != nil { + s.authTokenCancelFunc() + } + s.wg.Wait() metrics.ServerEventCounter.WithLabelValues(metrics.EventClose).Inc() } diff --git a/session/main_test.go b/session/main_test.go index a54a3378a4d8a..d44927580e55a 100644 --- a/session/main_test.go +++ b/session/main_test.go @@ -56,6 +56,7 @@ func TestMain(m *testing.M) { opts := []goleak.Option{ // TODO: figure the reason and shorten this list goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("github.com/tikv/client-go/v2/internal/retry.newBackoffFn.func1"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/v3.waitRetryBackoff"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), diff --git a/session/session_test/main_test.go b/session/session_test/main_test.go index 855ce6133f79c..849904506a0db 100644 --- a/session/session_test/main_test.go +++ b/session/session_test/main_test.go @@ -40,6 +40,7 @@ func TestMain(m *testing.M) { opts := []goleak.Option{ // TODO: figure the reason and shorten this list goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("github.com/tikv/client-go/v2/internal/retry.newBackoffFn.func1"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/v3.waitRetryBackoff"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), diff --git a/sessionctx/binloginfo/main_test.go b/sessionctx/binloginfo/main_test.go index a6d097b6a99c5..0459507352310 100644 --- a/sessionctx/binloginfo/main_test.go +++ b/sessionctx/binloginfo/main_test.go @@ -27,6 +27,7 @@ func TestMain(m *testing.M) { goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), } goleak.VerifyTestMain(m, opts...) } diff --git a/sessionctx/main_test.go b/sessionctx/main_test.go index ecaf2dcebe95a..e6c2bc990a57e 100644 --- a/sessionctx/main_test.go +++ b/sessionctx/main_test.go @@ -25,6 +25,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"), } diff --git a/sessionctx/stmtctx/main_test.go b/sessionctx/stmtctx/main_test.go index d9ea6f6a898e7..ba36da8e5c6b8 100644 --- a/sessionctx/stmtctx/main_test.go +++ b/sessionctx/stmtctx/main_test.go @@ -25,6 +25,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"), } diff --git a/sessionctx/variable/main_test.go b/sessionctx/variable/main_test.go index 977294bdc70d9..c5eca2f3d1658 100644 --- a/sessionctx/variable/main_test.go +++ b/sessionctx/variable/main_test.go @@ -25,6 +25,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"), } diff --git a/sessiontxn/isolation/main_test.go b/sessiontxn/isolation/main_test.go index aa8d031f70975..e0b8ace02bce6 100644 --- a/sessiontxn/isolation/main_test.go +++ b/sessiontxn/isolation/main_test.go @@ -39,6 +39,7 @@ func TestMain(m *testing.M) { tikv.EnableFailpoints() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"), } diff --git a/sessiontxn/staleread/main_test.go b/sessiontxn/staleread/main_test.go index 7ed95c5699c5c..fb4766298666c 100644 --- a/sessiontxn/staleread/main_test.go +++ b/sessiontxn/staleread/main_test.go @@ -26,6 +26,7 @@ func TestMain(m *testing.M) { tikv.EnableFailpoints() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"), } diff --git a/sessiontxn/txn_context_test.go b/sessiontxn/txn_context_test.go index 726782fe30088..7ecd85a1db982 100644 --- a/sessiontxn/txn_context_test.go +++ b/sessiontxn/txn_context_test.go @@ -40,6 +40,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"), goleak.IgnoreTopFunction("github.com/tikv/client-go/v2/txnkv/transaction.keepAlive"), diff --git a/statistics/handle/main_test.go b/statistics/handle/main_test.go index b6bf59c2e27c3..5541a01a46aa9 100644 --- a/statistics/handle/main_test.go +++ b/statistics/handle/main_test.go @@ -24,6 +24,7 @@ import ( func TestMain(m *testing.M) { opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"), } diff --git a/statistics/main_test.go b/statistics/main_test.go index b790b0e63076a..1d19e839a8297 100644 --- a/statistics/main_test.go +++ b/statistics/main_test.go @@ -49,6 +49,7 @@ func TestMain(m *testing.M) { opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"), } diff --git a/store/copr/copr_test/main_test.go b/store/copr/copr_test/main_test.go index 5c7afe2af5e3f..9b98a6a9ad944 100644 --- a/store/copr/copr_test/main_test.go +++ b/store/copr/copr_test/main_test.go @@ -40,6 +40,7 @@ func TestMain(m *testing.M) { opts := []goleak.Option{ // TODO: figure the reason and shorten this list goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("github.com/tikv/client-go/v2/internal/retry.newBackoffFn.func1"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/v3.waitRetryBackoff"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), diff --git a/store/copr/main_test.go b/store/copr/main_test.go index 9e9e2a02410e4..456b51156c8be 100644 --- a/store/copr/main_test.go +++ b/store/copr/main_test.go @@ -38,6 +38,7 @@ func TestMain(m *testing.M) { opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/pingcap/goleveldb/leveldb.(*DB).mpoolDrain"), goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"), } diff --git a/store/driver/error/error_test.go b/store/driver/error/error_test.go index dde341e8da4f1..f1f2878fb7743 100644 --- a/store/driver/error/error_test.go +++ b/store/driver/error/error_test.go @@ -29,6 +29,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"), } diff --git a/store/driver/main_test.go b/store/driver/main_test.go index 0b4cc12bbe62f..e0c805a52a952 100644 --- a/store/driver/main_test.go +++ b/store/driver/main_test.go @@ -41,6 +41,7 @@ func TestMain(m *testing.M) { tikv.EnableFailpoints() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"), } diff --git a/store/driver/txn/main_test.go b/store/driver/txn/main_test.go index ad777bb5af019..7c5fb240d8958 100644 --- a/store/driver/txn/main_test.go +++ b/store/driver/txn/main_test.go @@ -25,6 +25,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"), } diff --git a/store/gcworker/main_test.go b/store/gcworker/main_test.go index 4451f16783160..df72adb3a8f27 100644 --- a/store/gcworker/main_test.go +++ b/store/gcworker/main_test.go @@ -31,6 +31,7 @@ func TestMain(m *testing.M) { goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"), goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), } callback := func(i int) int { // wait for MVCCLevelDB to close, MVCCLevelDB will be closed in one second diff --git a/store/helper/main_test.go b/store/helper/main_test.go index 9c95a1fdbd9cf..3937580027775 100644 --- a/store/helper/main_test.go +++ b/store/helper/main_test.go @@ -25,6 +25,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"), } diff --git a/store/main_test.go b/store/main_test.go index 3c4d13ad381b8..4d0820e80c89b 100644 --- a/store/main_test.go +++ b/store/main_test.go @@ -25,6 +25,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"), } diff --git a/store/mockstore/main_test.go b/store/mockstore/main_test.go index daf0e059f2572..aa9718295ad04 100644 --- a/store/mockstore/main_test.go +++ b/store/mockstore/main_test.go @@ -32,6 +32,7 @@ func TestMain(m *testing.M) { } opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"), } diff --git a/store/mockstore/mockcopr/main_test.go b/store/mockstore/mockcopr/main_test.go index fa7a0a1e97df9..279862588c465 100644 --- a/store/mockstore/mockcopr/main_test.go +++ b/store/mockstore/mockcopr/main_test.go @@ -27,6 +27,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"), } diff --git a/store/mockstore/unistore/cophandler/main_test.go b/store/mockstore/unistore/cophandler/main_test.go index 0cd6c13b8cba0..5dbab5fb93a5b 100644 --- a/store/mockstore/unistore/cophandler/main_test.go +++ b/store/mockstore/unistore/cophandler/main_test.go @@ -25,6 +25,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"), } diff --git a/store/mockstore/unistore/lockstore/main_test.go b/store/mockstore/unistore/lockstore/main_test.go index bc28743788d54..09e8ebf061f44 100644 --- a/store/mockstore/unistore/lockstore/main_test.go +++ b/store/mockstore/unistore/lockstore/main_test.go @@ -25,6 +25,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"), } diff --git a/store/mockstore/unistore/main_test.go b/store/mockstore/unistore/main_test.go index b69415466734e..a2bcc6e1531f9 100644 --- a/store/mockstore/unistore/main_test.go +++ b/store/mockstore/unistore/main_test.go @@ -25,6 +25,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"), } diff --git a/store/mockstore/unistore/tikv/main_test.go b/store/mockstore/unistore/tikv/main_test.go index 07b836d7fd874..6b242bcddf291 100644 --- a/store/mockstore/unistore/tikv/main_test.go +++ b/store/mockstore/unistore/tikv/main_test.go @@ -25,6 +25,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"), } diff --git a/store/mockstore/unistore/util/lockwaiter/main_test.go b/store/mockstore/unistore/util/lockwaiter/main_test.go index 470e33909b5b0..27b0a5b93bd25 100644 --- a/store/mockstore/unistore/util/lockwaiter/main_test.go +++ b/store/mockstore/unistore/util/lockwaiter/main_test.go @@ -25,6 +25,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"), } diff --git a/structure/main_test.go b/structure/main_test.go index 12e8019bf3e47..956a8a8ad93d8 100644 --- a/structure/main_test.go +++ b/structure/main_test.go @@ -25,6 +25,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"), } diff --git a/table/main_test.go b/table/main_test.go index 79f1eaa5a9a71..019f53e9f303a 100644 --- a/table/main_test.go +++ b/table/main_test.go @@ -25,6 +25,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"), } diff --git a/table/tables/main_test.go b/table/tables/main_test.go index 63a616eeb69b0..d831e57364d33 100644 --- a/table/tables/main_test.go +++ b/table/tables/main_test.go @@ -25,6 +25,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"), } diff --git a/table/temptable/main_test.go b/table/temptable/main_test.go index 7ee3919b08f60..7dbc5e86d37d9 100644 --- a/table/temptable/main_test.go +++ b/table/temptable/main_test.go @@ -38,6 +38,7 @@ func TestMain(m *testing.M) { goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"), goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), } testsetup.SetupForCommonTest() goleak.VerifyTestMain(m, opts...) diff --git a/tablecodec/main_test.go b/tablecodec/main_test.go index ded843a887c9c..5024acdb32bdf 100644 --- a/tablecodec/main_test.go +++ b/tablecodec/main_test.go @@ -25,6 +25,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"), } diff --git a/tablecodec/rowindexcodec/main_test.go b/tablecodec/rowindexcodec/main_test.go index fed13e1f46a21..11b7963a4bd14 100644 --- a/tablecodec/rowindexcodec/main_test.go +++ b/tablecodec/rowindexcodec/main_test.go @@ -25,6 +25,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"), } diff --git a/telemetry/cte_test/cte_test.go b/telemetry/cte_test/cte_test.go index 32eed83e8df33..fac26ddb2f403 100644 --- a/telemetry/cte_test/cte_test.go +++ b/telemetry/cte_test/cte_test.go @@ -39,6 +39,7 @@ func TestMain(m *testing.M) { opts := []goleak.Option{ goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), } goleak.VerifyTestMain(m, opts...) diff --git a/telemetry/main_test.go b/telemetry/main_test.go index 698dd58e98635..0e8d98b2a4f6c 100644 --- a/telemetry/main_test.go +++ b/telemetry/main_test.go @@ -39,6 +39,7 @@ func TestMain(m *testing.M) { opts := []goleak.Option{ goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"), } diff --git a/tests/graceshutdown/main_test.go b/tests/graceshutdown/main_test.go index b480886282c4b..56da5e1a0590a 100644 --- a/tests/graceshutdown/main_test.go +++ b/tests/graceshutdown/main_test.go @@ -25,6 +25,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("syscall.syscall6"), } goleak.VerifyTestMain(m, opts...) diff --git a/tests/readonlytest/main_test.go b/tests/readonlytest/main_test.go index 7cdc72764ebb9..53cdfef25456b 100644 --- a/tests/readonlytest/main_test.go +++ b/tests/readonlytest/main_test.go @@ -25,6 +25,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"), } diff --git a/tests/realtikvtest/brietest/BUILD.bazel b/tests/realtikvtest/brietest/BUILD.bazel index f2c70ae0607e2..13a0561884186 100644 --- a/tests/realtikvtest/brietest/BUILD.bazel +++ b/tests/realtikvtest/brietest/BUILD.bazel @@ -18,11 +18,13 @@ go_test( "//sessionctx/binloginfo", "//store/mockstore/mockcopr", "//testkit", + "//testkit/testsetup", "//tests/realtikvtest", "@com_github_pingcap_failpoint//:failpoint", "@com_github_pingcap_tipb//go-binlog", "@com_github_stretchr_testify//require", "@com_github_tikv_client_go_v2//oracle", "@org_golang_google_grpc//:grpc", + "@org_uber_go_goleak//:goleak", ], ) diff --git a/tests/realtikvtest/brietest/main_test.go b/tests/realtikvtest/brietest/main_test.go index 6a022c35323b7..12b7cda9f1d1e 100644 --- a/tests/realtikvtest/brietest/main_test.go +++ b/tests/realtikvtest/brietest/main_test.go @@ -17,9 +17,23 @@ package brietest import ( "testing" + "github.com/pingcap/tidb/testkit/testsetup" "github.com/pingcap/tidb/tests/realtikvtest" + "go.uber.org/goleak" ) func TestMain(m *testing.M) { + opts := []goleak.Option{ + goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"), + goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), + goleak.IgnoreTopFunction("google.golang.org/grpc.(*ccBalancerWrapper).watcher"), + goleak.IgnoreTopFunction("google.golang.org/grpc/internal/transport.(*http2Client).keepalive"), + goleak.IgnoreTopFunction("google.golang.org/grpc/internal/transport.(*controlBuffer).get"), + goleak.IgnoreTopFunction("net/http.(*persistConn).writeLoop"), + goleak.IgnoreTopFunction("internal/poll.runtime_pollWait"), + } + testsetup.SetupForCommonTest() + goleak.VerifyTestMain(m, opts...) realtikvtest.RunTestMain(m) } diff --git a/tests/realtikvtest/statisticstest/BUILD.bazel b/tests/realtikvtest/statisticstest/BUILD.bazel index e9d8f215e7939..1203b0366c08b 100644 --- a/tests/realtikvtest/statisticstest/BUILD.bazel +++ b/tests/realtikvtest/statisticstest/BUILD.bazel @@ -12,7 +12,9 @@ go_test( deps = [ "//statistics/handle", "//testkit", + "//testkit/testsetup", "//tests/realtikvtest", "@com_github_stretchr_testify//require", + "@org_uber_go_goleak//:goleak", ], ) diff --git a/tests/realtikvtest/statisticstest/main_test.go b/tests/realtikvtest/statisticstest/main_test.go index 3010d3ee88066..8b9cf1e62690c 100644 --- a/tests/realtikvtest/statisticstest/main_test.go +++ b/tests/realtikvtest/statisticstest/main_test.go @@ -17,9 +17,19 @@ package statisticstest import ( "testing" + "github.com/pingcap/tidb/testkit/testsetup" "github.com/pingcap/tidb/tests/realtikvtest" + "go.uber.org/goleak" ) func TestMain(m *testing.M) { + opts := []goleak.Option{ + goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), + goleak.IgnoreTopFunction("internal/poll.runtime_pollWait"), + goleak.IgnoreTopFunction("net/http.(*persistConn).writeLoop"), + } + testsetup.SetupForCommonTest() + goleak.VerifyTestMain(m, opts...) realtikvtest.RunTestMain(m) } diff --git a/tests/realtikvtest/testkit.go b/tests/realtikvtest/testkit.go index 080a25958c508..b3ae5f3c6a2ac 100644 --- a/tests/realtikvtest/testkit.go +++ b/tests/realtikvtest/testkit.go @@ -55,6 +55,7 @@ func RunTestMain(m *testing.M) { tikv.EnableFailpoints() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("github.com/tikv/client-go/v2/internal/retry.newBackoffFn.func1"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/v3.waitRetryBackoff"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), diff --git a/tidb-server/main_test.go b/tidb-server/main_test.go index 5242f804f4378..cb0c53f4d2443 100644 --- a/tidb-server/main_test.go +++ b/tidb-server/main_test.go @@ -33,6 +33,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"), } diff --git a/types/main_test.go b/types/main_test.go index af337f93a762d..3e4fb3f087159 100644 --- a/types/main_test.go +++ b/types/main_test.go @@ -25,6 +25,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"), } diff --git a/types/parser_driver/main_test.go b/types/parser_driver/main_test.go index 19251613811d6..ebf7bf042bd54 100644 --- a/types/parser_driver/main_test.go +++ b/types/parser_driver/main_test.go @@ -25,6 +25,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), } goleak.VerifyTestMain(m, opts...) diff --git a/util/admin/main_test.go b/util/admin/main_test.go index 949b636970e43..ee1f2d5f2f116 100644 --- a/util/admin/main_test.go +++ b/util/admin/main_test.go @@ -32,6 +32,7 @@ func TestMain(m *testing.M) { opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), } diff --git a/util/arena/main_test.go b/util/arena/main_test.go index e35c6f526bf57..a399ad116c1b6 100644 --- a/util/arena/main_test.go +++ b/util/arena/main_test.go @@ -25,6 +25,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), } goleak.VerifyTestMain(m, opts...) diff --git a/util/benchdaily/main_test.go b/util/benchdaily/main_test.go index 6863e85113088..02836578e971d 100644 --- a/util/benchdaily/main_test.go +++ b/util/benchdaily/main_test.go @@ -25,6 +25,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), } goleak.VerifyTestMain(m, opts...) diff --git a/util/bitmap/main_test.go b/util/bitmap/main_test.go index e5f42a15b9d78..e023854dbc74e 100644 --- a/util/bitmap/main_test.go +++ b/util/bitmap/main_test.go @@ -25,6 +25,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), } goleak.VerifyTestMain(m, opts...) diff --git a/util/checksum/main_test.go b/util/checksum/main_test.go index e5465a5e61eec..4e41ef991f925 100644 --- a/util/checksum/main_test.go +++ b/util/checksum/main_test.go @@ -25,6 +25,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), } goleak.VerifyTestMain(m, opts...) diff --git a/util/codec/main_test.go b/util/codec/main_test.go index 32c64581b07df..d754807331c7f 100644 --- a/util/codec/main_test.go +++ b/util/codec/main_test.go @@ -25,6 +25,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), } goleak.VerifyTestMain(m, opts...) diff --git a/util/collate/main_test.go b/util/collate/main_test.go index 53916051ad294..42632ee9bd640 100644 --- a/util/collate/main_test.go +++ b/util/collate/main_test.go @@ -25,6 +25,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), } goleak.VerifyTestMain(m, opts...) diff --git a/util/cteutil/main_test.go b/util/cteutil/main_test.go index 2c6bb6eed00fa..44a7aeb89bc09 100644 --- a/util/cteutil/main_test.go +++ b/util/cteutil/main_test.go @@ -25,6 +25,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), } goleak.VerifyTestMain(m, opts...) diff --git a/util/dbterror/main_test.go b/util/dbterror/main_test.go index 133187cfb5e26..9e86cc8d329e3 100644 --- a/util/dbterror/main_test.go +++ b/util/dbterror/main_test.go @@ -25,6 +25,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), } goleak.VerifyTestMain(m, opts...) } diff --git a/util/deadlockhistory/main_test.go b/util/deadlockhistory/main_test.go index 6e21d6d732021..388b04f00bbf0 100644 --- a/util/deadlockhistory/main_test.go +++ b/util/deadlockhistory/main_test.go @@ -25,6 +25,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), } goleak.VerifyTestMain(m, opts...) diff --git a/util/disjointset/main_test.go b/util/disjointset/main_test.go index 1b4460b26d17c..4c7620d69dc07 100644 --- a/util/disjointset/main_test.go +++ b/util/disjointset/main_test.go @@ -25,6 +25,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), } goleak.VerifyTestMain(m, opts...) diff --git a/util/disk/main_test.go b/util/disk/main_test.go index 247e29ff0047d..b5dc84c28cf70 100644 --- a/util/disk/main_test.go +++ b/util/disk/main_test.go @@ -25,6 +25,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), } goleak.VerifyTestMain(m, opts...) diff --git a/util/execdetails/main_test.go b/util/execdetails/main_test.go index ee97941b29a63..0299931b53e97 100644 --- a/util/execdetails/main_test.go +++ b/util/execdetails/main_test.go @@ -24,6 +24,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), } goleak.VerifyTestMain(m, opts...) diff --git a/util/expensivequery/expensivequerey_test.go b/util/expensivequery/expensivequerey_test.go index 2d98435339d46..d7a83b14019fc 100644 --- a/util/expensivequery/expensivequerey_test.go +++ b/util/expensivequery/expensivequerey_test.go @@ -25,6 +25,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), } goleak.VerifyTestMain(m, opts...) diff --git a/util/fastrand/main_test.go b/util/fastrand/main_test.go index cf275eca82116..3aadf6e7f0a25 100644 --- a/util/fastrand/main_test.go +++ b/util/fastrand/main_test.go @@ -25,6 +25,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), } goleak.VerifyTestMain(m, opts...) diff --git a/util/format/main_test.go b/util/format/main_test.go index 4755a0230915c..080132ddf8844 100644 --- a/util/format/main_test.go +++ b/util/format/main_test.go @@ -25,6 +25,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), } goleak.VerifyTestMain(m, opts...) diff --git a/util/generatedexpr/main_test.go b/util/generatedexpr/main_test.go index 13347ccf5d48d..fc8f011ecfa2b 100644 --- a/util/generatedexpr/main_test.go +++ b/util/generatedexpr/main_test.go @@ -25,6 +25,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), } goleak.VerifyTestMain(m, opts...) diff --git a/util/hack/main_test.go b/util/hack/main_test.go index 7503891fc847b..152f4c57d6bb7 100644 --- a/util/hack/main_test.go +++ b/util/hack/main_test.go @@ -25,6 +25,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), } goleak.VerifyTestMain(m, opts...) diff --git a/util/keydecoder/main_test.go b/util/keydecoder/main_test.go index 56d9e58ffea48..893be9ecbb29e 100644 --- a/util/keydecoder/main_test.go +++ b/util/keydecoder/main_test.go @@ -24,6 +24,7 @@ import ( func TestMain(m *testing.M) { opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), } testsetup.SetupForCommonTest() diff --git a/util/kvcache/main_test.go b/util/kvcache/main_test.go index ea0330d7ef031..b6b1f7ef92d8f 100644 --- a/util/kvcache/main_test.go +++ b/util/kvcache/main_test.go @@ -25,6 +25,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), } goleak.VerifyTestMain(m, opts...) diff --git a/util/localpool/main_test.go b/util/localpool/main_test.go index 8e9efc8ad5ef3..10314587bb0a7 100644 --- a/util/localpool/main_test.go +++ b/util/localpool/main_test.go @@ -25,6 +25,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), } goleak.VerifyTestMain(m, opts...) diff --git a/util/logutil/main_test.go b/util/logutil/main_test.go index b1ac511fec3c1..03fdc6cc0bc3c 100644 --- a/util/logutil/main_test.go +++ b/util/logutil/main_test.go @@ -37,6 +37,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("gopkg.in/natefinch/lumberjack%2ev2.(*Logger).millRun"), } goleak.VerifyTestMain(m, opts...) diff --git a/util/main_test.go b/util/main_test.go index 195cb2094222b..05ed110d044d6 100644 --- a/util/main_test.go +++ b/util/main_test.go @@ -25,6 +25,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), } goleak.VerifyTestMain(m, opts...) diff --git a/util/mathutil/main_test.go b/util/mathutil/main_test.go index db09a75eb56af..3bdc670b7df19 100644 --- a/util/mathutil/main_test.go +++ b/util/mathutil/main_test.go @@ -25,6 +25,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), } goleak.VerifyTestMain(m, opts...) diff --git a/util/mock/main_test.go b/util/mock/main_test.go index 52fd2c12574b3..4583bc43b0f13 100644 --- a/util/mock/main_test.go +++ b/util/mock/main_test.go @@ -25,6 +25,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), } goleak.VerifyTestMain(m, opts...) diff --git a/util/mvmap/main_test.go b/util/mvmap/main_test.go index c2ff6e9dac75f..7a5f3a941f68c 100644 --- a/util/mvmap/main_test.go +++ b/util/mvmap/main_test.go @@ -25,6 +25,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), } goleak.VerifyTestMain(m, opts...) diff --git a/util/paging/main_test.go b/util/paging/main_test.go index 52190006ff270..4fc9fe6e363ad 100644 --- a/util/paging/main_test.go +++ b/util/paging/main_test.go @@ -25,6 +25,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), } goleak.VerifyTestMain(m, opts...) diff --git a/util/parser/main_test.go b/util/parser/main_test.go index 467ed06d6bbee..4b1832ae442a3 100644 --- a/util/parser/main_test.go +++ b/util/parser/main_test.go @@ -25,6 +25,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), } goleak.VerifyTestMain(m, opts...) diff --git a/util/plancodec/main_test.go b/util/plancodec/main_test.go index b561ae2ab3141..e91a5c7442f47 100644 --- a/util/plancodec/main_test.go +++ b/util/plancodec/main_test.go @@ -25,6 +25,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), } goleak.VerifyTestMain(m, opts...) diff --git a/util/printer/main_test.go b/util/printer/main_test.go index ce782dd021804..d56b58e4e2c77 100644 --- a/util/printer/main_test.go +++ b/util/printer/main_test.go @@ -25,6 +25,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), } goleak.VerifyTestMain(m, opts...) diff --git a/util/profile/main_test.go b/util/profile/main_test.go index 5c66882744193..f55422d993b8b 100644 --- a/util/profile/main_test.go +++ b/util/profile/main_test.go @@ -25,6 +25,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), } goleak.VerifyTestMain(m, opts...) diff --git a/util/ranger/main_test.go b/util/ranger/main_test.go index 7e4131603ab90..462007239334c 100644 --- a/util/ranger/main_test.go +++ b/util/ranger/main_test.go @@ -44,6 +44,7 @@ func TestMain(m *testing.M) { opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), goleak.IgnoreTopFunction("go.opencensus.io/stats/view.(*worker).start"), } diff --git a/util/resourcegrouptag/main_test.go b/util/resourcegrouptag/main_test.go index 436c89e6a7c9b..3b661ec89f0c6 100644 --- a/util/resourcegrouptag/main_test.go +++ b/util/resourcegrouptag/main_test.go @@ -25,6 +25,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), } goleak.VerifyTestMain(m, opts...) diff --git a/util/rowDecoder/main_test.go b/util/rowDecoder/main_test.go index e153efc436e7c..887a047796ea9 100644 --- a/util/rowDecoder/main_test.go +++ b/util/rowDecoder/main_test.go @@ -24,6 +24,7 @@ import ( func TestMain(m *testing.M) { opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), } testsetup.SetupForCommonTest() diff --git a/util/rowcodec/main_test.go b/util/rowcodec/main_test.go index 884964318ec8f..8a4515ed1c558 100644 --- a/util/rowcodec/main_test.go +++ b/util/rowcodec/main_test.go @@ -28,6 +28,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), } goleak.VerifyTestMain(m, opts...) diff --git a/util/selection/main_test.go b/util/selection/main_test.go index 1296c123f6bb7..74c14e7867157 100644 --- a/util/selection/main_test.go +++ b/util/selection/main_test.go @@ -25,6 +25,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), } goleak.VerifyTestMain(m, opts...) diff --git a/util/sem/main_test.go b/util/sem/main_test.go index a3c39e71b6135..7f6d20b904741 100644 --- a/util/sem/main_test.go +++ b/util/sem/main_test.go @@ -25,6 +25,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), } goleak.VerifyTestMain(m, opts...) diff --git a/util/set/main_test.go b/util/set/main_test.go index 515b5d13fc265..59f224554513f 100644 --- a/util/set/main_test.go +++ b/util/set/main_test.go @@ -25,6 +25,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), } goleak.VerifyTestMain(m, opts...) diff --git a/util/slice/main_test.go b/util/slice/main_test.go index cb09685762f55..3e886afa6be7b 100644 --- a/util/slice/main_test.go +++ b/util/slice/main_test.go @@ -25,6 +25,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), } goleak.VerifyTestMain(m, opts...) diff --git a/util/sqlexec/main_test.go b/util/sqlexec/main_test.go index 4b62e457496cd..f6e80059c0bab 100644 --- a/util/sqlexec/main_test.go +++ b/util/sqlexec/main_test.go @@ -25,6 +25,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), } goleak.VerifyTestMain(m, opts...) diff --git a/util/stmtsummary/main_test.go b/util/stmtsummary/main_test.go index 0b9a7e8d677f4..b2e92cd9a56ba 100644 --- a/util/stmtsummary/main_test.go +++ b/util/stmtsummary/main_test.go @@ -25,6 +25,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), } goleak.VerifyTestMain(m, opts...) diff --git a/util/stringutil/main_test.go b/util/stringutil/main_test.go index 0ae6ce85d93ec..09b386feae213 100644 --- a/util/stringutil/main_test.go +++ b/util/stringutil/main_test.go @@ -25,6 +25,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), } goleak.VerifyTestMain(m, opts...) diff --git a/util/sys/linux/main_test.go b/util/sys/linux/main_test.go index b021e636a64ed..88f9f2fdf24c3 100644 --- a/util/sys/linux/main_test.go +++ b/util/sys/linux/main_test.go @@ -25,6 +25,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), } goleak.VerifyTestMain(m, opts...) diff --git a/util/sys/storage/main_test.go b/util/sys/storage/main_test.go index 7a24dde8259a0..ef6ea743450f3 100644 --- a/util/sys/storage/main_test.go +++ b/util/sys/storage/main_test.go @@ -25,6 +25,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), } goleak.VerifyTestMain(m, opts...) diff --git a/util/systimemon/main_test.go b/util/systimemon/main_test.go index 7d9f1efd961c4..9539aca3a1096 100644 --- a/util/systimemon/main_test.go +++ b/util/systimemon/main_test.go @@ -26,6 +26,7 @@ func TestMain(m *testing.M) { opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("github.com/pingcap/tidb/util/systimemon.StartMonitor"), } diff --git a/util/texttree/main_test.go b/util/texttree/main_test.go index 8516e5e769179..c73786745d798 100644 --- a/util/texttree/main_test.go +++ b/util/texttree/main_test.go @@ -25,6 +25,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), } goleak.VerifyTestMain(m, opts...) diff --git a/util/timeutil/main_test.go b/util/timeutil/main_test.go index 2f09e2a8b84c6..add3ffbb50126 100644 --- a/util/timeutil/main_test.go +++ b/util/timeutil/main_test.go @@ -25,6 +25,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), } goleak.VerifyTestMain(m, opts...) diff --git a/util/topsql/collector/main_test.go b/util/topsql/collector/main_test.go index 82eddcefd5a34..1177b5d4f9c16 100644 --- a/util/topsql/collector/main_test.go +++ b/util/topsql/collector/main_test.go @@ -31,6 +31,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), } goleak.VerifyTestMain(m, opts...) diff --git a/util/topsql/main_test.go b/util/topsql/main_test.go index e5867303db32b..7317f50b2001b 100644 --- a/util/topsql/main_test.go +++ b/util/topsql/main_test.go @@ -25,6 +25,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), } goleak.VerifyTestMain(m, opts...) diff --git a/util/topsql/reporter/main_test.go b/util/topsql/reporter/main_test.go index cc46791c945df..f5f17f44ac7a6 100644 --- a/util/topsql/reporter/main_test.go +++ b/util/topsql/reporter/main_test.go @@ -25,6 +25,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), } goleak.VerifyTestMain(m, opts...) diff --git a/util/topsql/stmtstats/main_test.go b/util/topsql/stmtstats/main_test.go index c5d1ac3b50560..e75153cf9141f 100644 --- a/util/topsql/stmtstats/main_test.go +++ b/util/topsql/stmtstats/main_test.go @@ -25,6 +25,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), } goleak.VerifyTestMain(m, opts...) diff --git a/util/tracing/main_test.go b/util/tracing/main_test.go index 207e2e1b7b8e8..02cf4faecadb9 100644 --- a/util/tracing/main_test.go +++ b/util/tracing/main_test.go @@ -25,6 +25,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), } goleak.VerifyTestMain(m, opts...) diff --git a/util/vitess/main_test.go b/util/vitess/main_test.go index 498274e846fcf..b5f91d4df1535 100644 --- a/util/vitess/main_test.go +++ b/util/vitess/main_test.go @@ -25,6 +25,7 @@ func TestMain(m *testing.M) { testsetup.SetupForCommonTest() opts := []goleak.Option{ goleak.IgnoreTopFunction("github.com/golang/glog.(*loggingT).flushDaemon"), + goleak.IgnoreTopFunction("github.com/lestrrat-go/httprc.runFetchWorker"), goleak.IgnoreTopFunction("go.etcd.io/etcd/client/pkg/v3/logutil.(*MergeLogger).outputLoop"), } goleak.VerifyTestMain(m, opts...)