563 Commits

Author SHA1 Message Date
Benjamin Wang
ac98432f0b dependency: bump github.com/dustin/go-humanize from v1.0.0 to v1.0.1
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2023-01-17 06:37:19 +08:00
wafuwafu13
8b15146f27 clientv3: refactor getToken automatically
Signed-off-by: wafuwafu13 <mariobaske@i.softbank.jp>
2023-01-09 18:01:32 +09:00
WangXiaoxiao
49abfa5992 client/v3: fix comment typo
Signed-off-by: WangXiaoxiao <1141195807@qq.com>
2023-01-07 14:40:12 +08:00
Piotr Tabor
9abc895122 Goimports: Apply automated fixing to test files as well.
Signed-off-by: Piotr Tabor <ptab@google.com>
2022-12-29 13:04:45 +01:00
Piotr Tabor
6f899a7b40
Merge pull request #15052 from ptabor/20221228-goimports-fix
./scripts/fix.sh: Takes care of goimports across the whole project.
2022-12-29 11:31:22 +01:00
Piotr Tabor
9e1abbab6e Fix goimports in all existing files. Execution of ./scripts/fix.sh
Signed-off-by: Piotr Tabor <ptab@google.com>
2022-12-29 09:41:31 +01:00
Wei Fu
4d0b91947e chore: delete // +build buildtag by go fix
Signed-off-by: Wei Fu <fuweid89@gmail.com>
2022-12-29 14:17:05 +08:00
Benjamin Wang
9169522d72
Merge pull request #15021 from ramil600/em_manager
clientv3/naming/endpoints: fix endpoints prefix bug
2022-12-26 10:19:26 +08:00
Ramil Mirhasanov
f0153222f1 clientv3/naming/endpoints: fix endpoints prefix bug
fixes bug with multiple endpoints with same prefix

Signed-off-by: Ramil Mirhasanov <ramil600@yahoo.com>
2022-12-22 13:36:16 +03:00
Benjamin Wang
054b24b425
Merge pull request #15031 from ahrtr/SnapshotWithVersion_nil_panic_20221220
clientv3: add protection code to prevent SnapshotWithVersion from panicking
2022-12-21 06:45:31 +08:00
Benjamin Wang
4d9b709ce0
Merge pull request #15024 from wafuwafu13/client-isunavailableerr-test
test(client): add `TestIsUnavailableErr`
2022-12-21 06:42:44 +08:00
wafuwafu13
2041d5f245 fix: change error message
Signed-off-by: wafuwafu13 <mariobaske@i.softbank.jp>
2022-12-20 21:54:52 +09:00
wafuwafu13
57413851b6 fix(client): change error message
Signed-off-by: wafuwafu13 <mariobaske@i.softbank.jp>
2022-12-20 21:52:59 +09:00
wafuwafu13
dc88d90763 test: add TestIsUnavailableErr
Signed-off-by: wafuwafu13 <mariobaske@i.softbank.jp>
2022-12-20 21:52:59 +09:00
wafuwafu13
77e4e87ee7 refactor: use assert
Signed-off-by: wafuwafu13 <mariobaske@i.softbank.jp>
2022-12-20 21:52:58 +09:00
Benjamin Wang
39d96b2557 clientv3: add protection code to prevent SnapshotWithVersion from panicking
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-12-20 12:51:08 +08:00
Benjamin Wang
d3619e9332
Merge pull request #15012 from wafuwafu13/credentials-test
test(client): add `credentials_test.go`
2022-12-20 10:25:00 +08:00
Piotr Tabor
6fc0d96b42
Merge pull request #14993 from ramil600/add-log
clientv3/concurrency: add logger to session, add unit test
2022-12-19 10:30:38 +01:00
wafuwafu13
8bd191ae99 test(client): add credentials_test.go
Signed-off-by: wafuwafu13 <mariobaske@i.softbank.jp>
2022-12-17 18:21:20 +09:00
Ramil Mirhasanov
3c582fecb0 clientv3/concurrency: add logger to session, add unit test
Signed-off-by: Ramil Mirhasanov <ramil600@yahoo.com>
2022-12-16 11:11:35 +03:00
Benjamin Wang
2c192f4205 deps: bump go.uber.org/multierr from 1.8.0 to 1.9.0 in /server
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-12-14 04:00:49 +08:00
Benjamin Wang
c2a7a5870d deps: bump github.com/prometheus/client_golang from 1.12.2 to 1.14.0
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-12-14 03:42:11 +08:00
Benjamin Wang
bc41c0963b deps: bump github.com/coreos/go-systemd/v22 from 22.3.2 to 22.5.0
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-12-14 03:38:55 +08:00
Benjamin Wang
1a0af6fee6 deps: bump go.uber.org/zap from 1.21.0 to 1.24.0
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-12-14 03:33:24 +08:00
Benjamin Wang
d11cc9e651
Merge pull request #14922 from ramil600/target-endpoint
resolver: cleanup of deprecated grpc resolver target.Endpoint field
2022-12-14 03:24:20 +08:00
Ramil Mirhasanov
932cb95e37 resolver: cleanup of deprecated grpc resolver target.Endpoint field
target.Endpoint and some other fields are deprecated, URL field is
suggested to use instead
path is required to be stripped of "/" prefix for naming/resolver to
work porperly

Signed-off-by: Ramil Mirhasanov <ramil600@yahoo.com>
2022-12-13 08:39:26 +03:00
Benjamin Wang
d0e753ca86 clientv3: define local variables errMsgGRPCInvalidAuthToken and errMsgGRPCAuthOldRevision to cache gRPC error messages
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-12-13 07:28:59 +08:00
Benjamin Wang
19dc0cb413 client: enhance the function shouldRetryWatch and added unit test
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-12-13 06:05:02 +08:00
Benjamin Wang
1ba246e1d8 bump golang.org/x/ to v0.4.0
Found 1 known vulnerability.

Vulnerability #1: GO-2022-1144
  An attacker can cause excessive memory growth in a Go server
  accepting HTTP/2 requests. HTTP/2 server connections contain a
  cache of HTTP header keys sent by the client. While the total
  number of entries in this cache is capped, an attacker sending
  very large keys can cause the server to allocate approximately
  64 MiB per open connection.

  Call stacks in your code:
Error:       tools/etcd-dump-metrics/main.go:158:5: go.etcd.io/etcd/v3/tools/etcd-dump-metrics.main calls go.etcd.io/etcd/server/v3/embed.StartEtcd, which eventually calls golang.org/x/net/http2.Server.ServeConn

  Found in: golang.org/x/net/http2@v0.2.0
  Fixed in: golang.org/x/net/http2@v0.4.0
  More info: https://pkg.go.dev/vuln/GO-2022-1144
Error: Process completed with exit code 3.

Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-12-09 08:54:48 +08:00
Benjamin Wang
3f86db5e53 bump golang.org/x imports to address CVEs
Reference: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-32149

Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-11-30 05:03:43 +08:00
Benjamin Wang
cf171fdd1d
Merge pull request #14828 from ahrtr/identify_corrupted_member_20221123
Identify corrupted member depending on quorum
2022-11-29 06:08:25 +08:00
Wei Fu
cd9ade5403 client/pkg/transport: fix typo in _test.go
Signed-off-by: Wei Fu <fuweid89@gmail.com>
2022-11-27 22:10:06 +08:00
Wei Fu
8a88660262 client/pkg/transport: deflake TestWriteReadTimeoutListener
There is data race on `stop` channel. After verify write-timeout successfully,
the case won't wait for `blocker` to receive close signal from `stop` channel.
If the new `blocker`, which is to read-timeout verifier, get dial's result
immediately, the new `blocker` might fetch the message from `stop` channel
before old one and then close the connection, which causes that the
`conn.Read` returns `EOF` when it reads data.

How to reproduce this in linux devbox?

Use `taskset` to limit the test process in one-cpu.

```bash
cd ./client/pkg/transport
go test -c -o /tmp/test --race=true ./
taskset -c 0 /tmp/test -test.run TestWriteReadTimeoutListener -test.v -test.cpu 4 -test.count=10000 -test.failfast
```

To fix this, suggest to use seperate `stop` channel to prevent from data
race.

Signed-off-by: Wei Fu <fuweid89@gmail.com>
2022-11-27 22:06:11 +08:00
Benjamin Wang
8b98fee9ce etcdserver: detect corrupted member based on quorum
When the leader detects data inconsistency by comparing hashes,
currently it assumes that the follower is the corrupted member.
It isn't correct, the leader might be the corrupted member as well.

We should depend on quorum to identify the corrupted member.
For example, for 3 member cluster, if 2 members have the same hash,
the the member with different hash is the corrupted one. For 5 member
cluster, if 3 members have the same same, the corrupted member is one
of the left two members; it's also possible that both the left members
are corrupted.

Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-11-26 19:35:38 +08:00
Benjamin Wang
285e44378f bump github.com/stretchr/testify from v1.7.2 to v1.8.1
Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-11-26 10:51:32 +08:00
Wei Fu
cf285ea3c7 bump grpc to v1.51.0 from v1.47.0
Signed-off-by: Wei Fu <fuweid89@gmail.com>
2022-11-23 22:16:22 +08:00
Andrew Sims
f656fa0f49 add missing copyright headers
Signed-off-by: Andrew Sims <andrew.cameron.sims@gmail.com>
2022-11-23 19:13:43 +11:00
Abhishek Choudhary
0721d2f254
client: update comment for clarity
Signed-off-by: Abhishek Choudhary <shreemaan.abhishek@gmail.com>
2022-11-22 19:25:46 +05:30
Benjamin Wang
6d8139dcea
Merge pull request #14788 from sashamelentyev/imports
all: goimports -w .
2022-11-18 09:03:43 +08:00
Sasha Melentyev
c3b6cbdb73 all: goimports -w .
Signed-off-by: Sasha Melentyev <sasha@melentyev.io>
2022-11-17 19:07:04 +03:00
cleverhu
d726e9a183 docs: fix max recv msg size description
The correct param forMaxCallRecvMsgSize is '--max-recv-bytes' instead of '--max-request-bytes', so I fixed the documentation and description.

Signed-off-by: cleverhu <shouping.hu@daocloud.io>
2022-11-17 10:37:55 +08:00
Benjamin Wang
f32ac6e069 clientv3: do not refresh token when using TLS CommonName based authentication
When users use the TLS CommonName based authentication, the
authTokenBundle is always nil. But it's possible for the clients
to get `rpctypes.ErrAuthOldRevision` response when the clients
concurrently modify auth data (e.g, addUser, deleteUser etc.).
In this case, there is no need to refresh the token; instead the
clients just need to retry the operations (e.g. Put, Delete etc).

Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-11-16 18:31:53 +08:00
Benjamin Wang
bf5c936ff1
Merge pull request #14731 from ramil600/grpc_withinsecure
client/v3: replace deprecated grpc.WithInsecure()  issue #14732
2022-11-16 06:41:29 +08:00
Sasha Melentyev
95c520976a client: Use func without format
Signed-off-by: Sasha Melentyev <sasha@melentyev.io>
2022-11-15 01:02:24 +03:00
Ramil Mirhasanov
44d8e732cf client/v3: replace deprecated grpc.WithInsecure()
Deprecated: use WithTransportCredentials and insecure.NewCredentials() instead. Will be supported throughout 1.x.

Signed-off-by: Ramil Mirhasanov <ramil600@yahoo.com>
2022-11-11 12:08:50 +03:00
chenyahui
5b8c6b548f etcdclient: check mutex state in Unlock method of concurrency.Mutex
Check the values of myKey and myRev first in Unlock method to prevent calling Unlock without Lock. Because this may cause the value of pfx to be deleted by mistake.

Signed-off-by: chenyahui <cyhone@qq.com>
2022-11-08 22:24:52 +08:00
Benjamin Wang
b08209447a
Merge pull request #14368 from happlins/main
clientv3: fix init client error
2022-11-07 06:36:13 +08:00
Benjamin Wang
7f46da223d client: no need to getToken when dial specific endpoint for maintenance
The existing client may connect to different endpoint from the
specific endpoint to be maintained. Maintenance operations do not
go through raft at all, so it might run into issue if the server
hasn't finished applying the authentication request.

Let's work with an example. Assuming the existing client connects to
ep1, while the user wants to maintain ep2. If we getToken again, it
sends an authentication request, which goes through raft. When the
specific endpoint receives the maintenance request, it might haven't
finished previous authentication request, but the new token is already
carried in the context, so it will reject the maintenance request
due to invalid token.

We already have retry logic in `unaryClientInterceptor` and
`streamClientInterceptor`. When the token expires, it can automatically
refresh the token, so it should be safe to remove the `getToken`
logic in `maintenance.dial`

Signed-off-by: Benjamin Wang <wachao@vmware.com>
2022-11-03 04:39:42 +08:00
Benjamin Wang
a1018dbddf
Merge pull request #14604 from ahrtr/double_barrier
clientv3: fix the implementation of double barrier
2022-10-31 08:13:12 +08:00
jianfei.zhang
d75d1e575a fix: close conn
Signed-off-by: jianfei.zhang <jianfei.zhang@daocloud.io>
2022-10-27 11:09:14 +08:00