Commit Graph

975 Commits (b6d98719f6aae6c4628962d027a17d21d7b1d909)

Author SHA1 Message Date
Gyuho Lee eeb371b7c1 clientv3: fix racy writes to context key
=== RUN   TestWatchOverlapContextCancel

==================

WARNING: DATA RACE

Write at 0x00c42110dd40 by goroutine 99:

  runtime.mapassign()

      /usr/local/go/src/runtime/hashmap.go:485 +0x0

  github.com/coreos/etcd/clientv3.metadataSet()

      /go/src/github.com/coreos/etcd/gopath/src/github.com/coreos/etcd/clientv3/ctx.go:61 +0x8c

  github.com/coreos/etcd/clientv3.withVersion()

      /go/src/github.com/coreos/etcd/gopath/src/github.com/coreos/etcd/clientv3/ctx.go:47 +0x137

  github.com/coreos/etcd/clientv3.newStreamClientInterceptor.func1()

      /go/src/github.com/coreos/etcd/gopath/src/github.com/coreos/etcd/clientv3/client.go:309 +0x81

  google.golang.org/grpc.NewClientStream()

      /go/src/github.com/coreos/etcd/gopath/src/google.golang.org/grpc/stream.go:101 +0x10e

  github.com/coreos/etcd/etcdserver/etcdserverpb.(*watchClient).Watch()

      /go/src/github.com/coreos/etcd/gopath/src/github.com/coreos/etcd/etcdserver/etcdserverpb/rpc.pb.go:3193 +0xe9

  github.com/coreos/etcd/clientv3.(*watchGrpcStream).openWatchClient()

      /go/src/github.com/coreos/etcd/gopath/src/github.com/coreos/etcd/clientv3/watch.go:788 +0x143

  github.com/coreos/etcd/clientv3.(*watchGrpcStream).newWatchClient()

      /go/src/github.com/coreos/etcd/gopath/src/github.com/coreos/etcd/clientv3/watch.go:700 +0x5c3

  github.com/coreos/etcd/clientv3.(*watchGrpcStream).run()

      /go/src/github.com/coreos/etcd/gopath/src/github.com/coreos/etcd/clientv3/watch.go:431 +0x12b

Previous read at 0x00c42110dd40 by goroutine 130:

  reflect.maplen()

      /usr/local/go/src/runtime/hashmap.go:1165 +0x0

  reflect.Value.MapKeys()

      /usr/local/go/src/reflect/value.go:1090 +0x43b

  fmt.(*pp).printValue()

      /usr/local/go/src/fmt/print.go:741 +0x1885

  fmt.(*pp).printArg()

      /usr/local/go/src/fmt/print.go:682 +0x1b1

  fmt.(*pp).doPrintf()

      /usr/local/go/src/fmt/print.go:998 +0x1cad

  fmt.Sprintf()

      /usr/local/go/src/fmt/print.go:196 +0x77

  github.com/coreos/etcd/clientv3.streamKeyFromCtx()

      /go/src/github.com/coreos/etcd/gopath/src/github.com/coreos/etcd/clientv3/watch.go:825 +0xc8

  github.com/coreos/etcd/clientv3.(*watcher).Watch()

      /go/src/github.com/coreos/etcd/gopath/src/github.com/coreos/etcd/clientv3/watch.go:265 +0x426

  github.com/coreos/etcd/clientv3/integration.testWatchOverlapContextCancel.func1()

      /go/src/github.com/coreos/etcd/gopath/src/github.com/coreos/etcd/clientv3/integration/watch_test.go:959 +0x23e

Goroutine 99 (running) created at:

  github.com/coreos/etcd/clientv3.(*watcher).newWatcherGrpcStream()

      /go/src/github.com/coreos/etcd/gopath/src/github.com/coreos/etcd/clientv3/watch.go:236 +0x59d

  github.com/coreos/etcd/clientv3.(*watcher).Watch()

      /go/src/github.com/coreos/etcd/gopath/src/github.com/coreos/etcd/clientv3/watch.go:278 +0xbb6

  github.com/coreos/etcd/clientv3/integration.testWatchOverlapContextCancel.func1()

      /go/src/github.com/coreos/etcd/gopath/src/github.com/coreos/etcd/clientv3/integration/watch_test.go:959 +0x23e

Goroutine 130 (running) created at:

  github.com/coreos/etcd/clientv3/integration.testWatchOverlapContextCancel()

      /go/src/github.com/coreos/etcd/gopath/src/github.com/coreos/etcd/clientv3/integration/watch_test.go:979 +0x76d

  github.com/coreos/etcd/clientv3/integration.TestWatchOverlapContextCancel()

      /go/src/github.com/coreos/etcd/gopath/src/github.com/coreos/etcd/clientv3/integration/watch_test.go:922 +0x44

  testing.tRunner()

      /usr/local/go/src/testing/testing.go:657 +0x107

==================

Signed-off-by: Gyuho Lee <leegyuho@amazon.com>
2020-03-18 17:05:05 -07:00
Gyuho Lee 33907477dd *: add "etcd_server_client_requests_total", tests
Signed-off-by: Gyuho Lee <leegyuho@amazon.com>
2020-03-17 12:16:11 -07:00
Gyuho Lee 58ba322bb4 clientv3: embed API version
Signed-off-by: Gyuho Lee <leegyuho@amazon.com>
2020-03-17 12:16:11 -07:00
Gyuho Lee 5cb1e0b342 clientv3: fix metadata overwrites in "WithRequireLeader"
Signed-off-by: Gyuho Lee <leegyuho@amazon.com>
2020-03-17 12:16:11 -07:00
Joe Betz 221f0cc107
Merge pull request #11564 from eddycjy/balancer-error
clientv3: Fix grpc-go(v1.27.0) incompatible changes to balancer/resolver.
2020-03-06 10:35:22 -08:00
EDDYCJY 4258cdd2ef clientv3: fix grpc-go(v1.27.0) incompatible changes to balancer/resolver. 2020-02-18 18:27:53 +08:00
Jingyi Hu 84ace97ad7
Merge pull request #11572 from lzhfromustc/API_Fatal_4
integration/clientv3: fix 4 API misusage in test functions
2020-02-14 00:27:41 -08:00
Ziheng Liu f00394e384 integration/clientv3: fix 4 API misusage in test functions 2020-02-13 13:13:18 -05:00
Vern Burton 071e70cdc4
*: add a new API and command for checking auth status (#11536)
This changes have started at etcdctl under auth.go, and make changes to stub out everything down into the internal raft.  Made changes to the .proto files and regenerated them so that the local version would build successfully.
2020-02-05 19:27:42 -08:00
Jingyi Hu 7395ed8e5d
Merge pull request #11578 from jingyih/set_zap_as_default_logger
*: set zap as default logger, remove capnslog
2020-02-04 22:58:45 -08:00
jingyih 725e09023a *: set zap as default logger, remove capnslog
Set zap as default logger. Remove capnslog and deprecated logging
flags.
2020-02-04 04:57:49 -08:00
Gyuho Lee a698ad65f5
Merge pull request #11574 from YoyinZyc/simpligy-grpc
clientv3: simplify grpc dialer usage.
2020-02-03 12:41:41 -08:00
yoyinzyc b90d801beb clientV3: simplify grpc dialer usage. Remove workaround #11184 after bumping grpc to 1.26.0. 2020-01-30 14:51:24 -08:00
sfzhu93 467e08c32a
in multiple packages: fixed goroutine leak bugs in tests (cont.d) (#11570) 2020-01-30 10:55:59 -08:00
sfzhu93 cad92706cf
in multiple packages: fixed goroutine leak bugs in tests (#11569) 2020-01-30 10:45:59 -08:00
Jingyi Hu 342c2464ae Documentation: specify starting revision (#11559) 2020-01-27 10:18:27 -08:00
Gyuho Lee 993e82a85b clientv3/integration: fix a typo in "TestLeasingTxnRangeCmp"
Signed-off-by: Gyuho Lee <leegyuho@amazon.com>
2020-01-19 23:56:22 -08:00
Gyuho Lee 2669b83c68 clientv3/integration: fix typo in "TestLeasingRevGet"
Signed-off-by: Gyuho Lee <leegyuho@amazon.com>
2020-01-19 10:20:23 -08:00
Gyuho Lee 091b84f154 clientv3/integration: fix "TestLeaseKeepAliveNotFound"
with "default" select, the failure case will never be selected

Signed-off-by: Gyuho Lee <leegyuho@amazon.com>
2020-01-17 12:04:10 -08:00
Gyuho Lee 255944bf51 clientv3/integration: expect "ErrCompacted" in "TestKVCompact"
Making tests more strict

Signed-off-by: Gyuho Lee <leegyuho@amazon.com>
2020-01-17 12:03:13 -08:00
Ted Yu b95a465235 Auth: declare auth variable inside the loop (#11476)
Co-authored-by: yutedz <54038175+yutedz@users.noreply.github.com>
2020-01-13 19:23:00 -08:00
Jingyi Hu 5adad5e224
Merge pull request #11452 from tedyu/watch-grpc-send-err
clientv3: log warning in case of error sending request
2019-12-20 15:31:02 -08:00
Ted Yu cb8bf089f8 clientv3: log warning in case of error sending request 2019-12-20 15:08:33 -08:00
Ted Yu fb7703ab43 clientv3: remove ineffective nil check (#11451) 2019-12-15 21:38:25 -08:00
Jingyi Hu ed5a01a48d etcdserver: recover cluster version from backend 2019-12-05 16:25:13 -08:00
Xiang Li b14c7cd448 concurrency: make lock more reliable 2019-12-02 10:54:30 -08:00
Gyuho Lee 5dc98c50d7 clientv3: fix retry/streamer error message
Signed-off-by: Gyuho Lee <leegyuho@amazon.com>
2019-10-30 21:29:44 -07:00
Joe Betz 6aae90325c
Merge pull request #11211 from jpbetz/ipv6-endpoints
Replace endpoint.ParseHostPort with net.SplitHostPort to fix IPv6 client endpoints
2019-10-08 15:15:16 -07:00
Joe Betz 594354b886
Replace endpoint.ParseHostPort with net.SplitHostPort to fix IPv6 client endpoints 2019-10-08 14:53:49 -07:00
Gyuho Lee 340f0ac797
Merge pull request #11179 from YoyinZyc/trace
Add tracing to range request in etcd server.
2019-10-08 13:23:53 -07:00
yoyinzyc 401df4bb8e etcdserver: add put request steps.
mvcc: add put request steps; add trace to KV.Write() as input parameter.
2019-10-01 14:08:06 -07:00
Joe Betz 97388ce454
clientv3: Set authority used in cert checks to host of endpoint 2019-09-25 15:14:23 -07:00
Jingguo Yao e24564224a clientv3: remove the redundant CancelFunc invocation 2019-09-18 23:06:49 +08:00
Jingguo Yao e53298afb1 clientv3/concurrency: remove the unneeded slash
Since NewMutex will append a slash to pfx, there is no need to append a
slash beforehand.
2019-09-18 16:37:31 +08:00
Guangming Wang 6287052bd0 integration: fix bug in for loop, make it break properly 2019-09-17 11:27:31 +08:00
vimalk78 04ddfa8b8d clientv3/concurrency: Added Mutex.TryLock()
TryLock locks the mutex if not already locked by another session.
If lock is held by another session, return immediately after attempting necessary cleanup

Added integration test

Fixes #10493
2019-09-09 20:16:07 -07:00
Xiang Li dd2b88d0ed
Merge pull request #11066 from vimalk78/clientv3-fixes
clientv3: add nil checks in Client.Close()
2019-08-23 23:22:42 -07:00
Jingyi Hu 2680c2afe7 integration: fix TestKVPutError
Give backend quota enough overhead.
2019-08-21 19:56:38 -07:00
vimalk78 7f47de8414 clientv3: add nil checks in Close()
Added nil checks in Close() for Watcher and Lease fields
Added test case
2019-08-21 23:04:42 +01:00
Gyuho Lee b5aa46486b clientv3/integration: fix "mvcc.NewStore" call
Signed-off-by: Gyuho Lee <leegyuho@amazon.com>
2019-08-15 11:48:53 -07:00
Joe Betz 9b51febaf5 *: Add experimental-compaction-batch-limit flag 2019-08-15 11:47:23 -07:00
Gyuho Lee 97fd40c587 clientv3: use Endpoints(), fix context creation
If overwritten, the previous context should be canceled first.

Signed-off-by: Gyuho Lee <leegyuho@amazon.com>
2019-08-12 21:39:50 -07:00
Zeming YU 181419256d integration: fix a data race about `err`
don't share `err` between goroutines
2019-08-06 14:58:15 -07:00
Gyuho Lee 9b385737f5 clientv3: deprecate "grpc.ErrClientConnClosing"
Signed-off-by: Gyuho Lee <leegyuho@amazon.com>
2019-08-05 13:27:16 -07:00
Gyuho Lee 4b0af5b4ac clientv3: document "WithBlock" dial option
Signed-off-by: Gyuho Lee <leegyuho@amazon.com>
2019-08-04 23:52:17 -07:00
Gyuho Lee ba42e65b59 clientv3/integration: give more time for balancer resolution
Signed-off-by: Gyuho Lee <leegyuho@amazon.com>
2019-07-26 09:19:22 -07:00
Gyuho Lee 8c7c6ec0c1 clientv3/balancer: refactor
refactor + remove unused

Signed-off-by: Gyuho Lee <leegyuho@amazon.com>
2019-07-26 09:19:19 -07:00
Gyuho Lee 3dc00ab615 clientv3: move auth token credential to "credentials" package
Signed-off-by: Gyuho Lee <leegyuho@amazon.com>
2019-07-26 09:17:44 -07:00
Gyuho Lee db61ee106c clientv3/credentials: set dial target "Authority" with target address
Overwrite authority when it's IP.

When user dials with "grpc.WithDialer", "grpc.DialContext" "cc.parsedTarget"
update only happens once. This is problematic, because when TLS is enabled,
retries happen through "grpc.WithDialer" with static "cc.parsedTarget" from
the initial dial call.
If the server authenticates by IP addresses, we want to set a new endpoint as
a new authority. Otherwise
"transport: authentication handshake failed: x509: certificate is valid for 127.0.0.1, 192.168.121.180, not 192.168.223.156"
when the new dial target is "192.168.121.180" whose certificate host name is also "192.168.121.180"
but client tries to authenticate with previously set "cc.parsedTarget" field "192.168.223.156"

Signed-off-by: Gyuho Lee <leegyuho@amazon.com>
2019-07-26 09:17:40 -07:00
Gyuho Lee db7231accc clientv3: use new "credentials" package
Signed-off-by: Gyuho Lee <leegyuho@amazon.com>
2019-07-26 08:56:33 -07:00