Comments (13)
@ivanvc The source code you mentioned above is where etcdserver receives gRPC requests, this issue is about receiving REST(HTTP) requests.
Note that etcdserver receives REST(HTTP) request via the grpc-gateway.
I think the reason why the build-in gateway doesn't have such issue is that the gateway carries the http request header over to the following gRPC request,
Please read
-
etcd/api/etcdserverpb/gw/rpc.pb.gw.go
Line 2354 in fc337b0
The existing e2e test cases should have already verified it.
from etcd.
Here is the related PR #18012.
from etcd.
It seems like a valid issue. We don't see much use case on grpcProxy, so I don't think this is a major issue.
- etcdserver not only supports grpc requests, but also REST requests (see below), so we need to double check whether the build-in gateway has similar issue.
Lines 312 to 326 in 97a9af9
Can anyone double check this? @ivanvc @siyuanfoundation @chaochn47 @tjungblu
- For this issue, we should add an simple e2e test to reproduce the issue firstly in etcd_grpcproxy_test.go in the first commit (ensure you can reproduce the issue with the e2e test), then apply your fix as the second commit.
from etcd.
I also checked the build-in gateway, it seems OK. I think the implementation is different in etcdserver and grpcproxy server, which leads to the different behavior.
We mainly use grpcproxy to reduce the watch pressure from apisix to etcdserver.
I will add an simple e2e test soon.
Thanks for your reply.
from etcd.
Can anyone double check this? @ivanvc @siyuanfoundation @chaochn47 @tjungblu
I think the built-in gateway (if I'm correct, it should be in server/etcdserver/api/v3rpc/grpc.go
), is forwarding the metadata. Refer to:
etcd/server/etcdserver/api/v3rpc/grpc.go
Lines 43 to 47 in 97a9af9
And newUnaryInterceptor(...)
:
etcd/server/etcdserver/api/v3rpc/interceptor.go
Lines 46 to 76 in 97a9af9
The source code for release 3.5 is very similar, it doesn't appear to happen there either:
https://github.com/etcd-io/etcd/blob/v3.5.13/server/etcdserver/api/v3rpc/grpc.go#L45-L49 / https://github.com/etcd-io/etcd/blob/v3.5.13/server/etcdserver/api/v3rpc/interceptor.go#L46-L73
Caveats: I'm still not too familiar with etcdserver
, so I apologize if my answer is misleading.
from etcd.
The existing e2e test cases should have already verified it.
https://github.com/etcd-io/etcd/blob/main/tests/e2e/v3_curl_auth_test.go
from etcd.
Thanks for your reply, Do we have any comments for the watch cancled error? This is another problem which I think is more important than auth. I try to fix the watch canceled error in #18012 . Looking forward for reviewing. The discussions above seem focusing on the auth problem. @ahrtr @ivanvc
from etcd.
Do we have any comments for the watch cancled error?
I am not sure what issue you are talking about here. Please feel free to raise another issue to track it if not present.
Please let's only fix one thing/issue in one PR. Please add an e2e test to reproduce the issue firstly, please read the second point in #18011 (comment)
from etcd.
Do we have any comments for the watch cancled error?
I am not sure what issue you are talking about here. Please feel free to raise another issue to track it if not present.
Please let's only fix one thing/issue in one PR. Please add an e2e test to reproduce the issue firstly, please read the second point in #18011 (comment)
Thanks for your reply, I'll add e2e tests in a fews days and recommit the PR.
The watch context cancled error is described as the first part of this issue, maybe not clearly. I copied the part below.
Start etcd(v3.5.13) and grpc-proxy locally by commands below:
nohup etcd&
nohup etcd grpc-proxy start --endpoints=localhost:2379 &
Then start grpc-gateway locally(compiled by the code above).
Send watch command to grpc-gateway with curl:
curl -X POST -d '{"create_request": {"key":"dGVzdGtleQo=","range_end":"dGVzdGtleTEK"}}' 'localhost:8887/v3/watch'
The curl command returns directly instead of waiting for watch response,with the error repsose below:
{"result":{"header":{"cluster_id":"14841639068965178418","member_id":"10276657743932975437","revision":"1","raft_term":"2"},"created":true}} {"error":{"grpc_code":1,"http_code":408,"message":"context canceled","http_status":"Request Timeout"}}
from etcd.
Then start grpc-gateway locally(compiled by the code above). Send watch command to grpc-gateway with curl:
curl -X POST -d '{"create_request": {"key":"dGVzdGtleQo=","range_end":"dGVzdGtleTEK"}}' 'localhost:8887/v3/watch'
The curl command returns directly instead of waiting for watch response,with the error repsose below:
{"result":{"header":{"cluster_id":"14841639068965178418","member_id":"10276657743932975437","revision":"1","raft_term":"2"},"created":true}} {"error":{"grpc_code":1,"http_code":408,"message":"context canceled","http_status":"Request Timeout"}}
The error is returned by your grpc-gateway, so you need to debug it firstly. Please let me know if you see any issue when you watch a key via etcd or grpc-proxy directly.
from etcd.
Then start grpc-gateway locally(compiled by the code above). Send watch command to grpc-gateway with curl:
curl -X POST -d '{"create_request": {"key":"dGVzdGtleQo=","range_end":"dGVzdGtleTEK"}}' 'localhost:8887/v3/watch'
The curl command returns directly instead of waiting for watch response,with the error repsose below:
{"result":{"header":{"cluster_id":"14841639068965178418","member_id":"10276657743932975437","revision":"1","raft_term":"2"},"created":true}} {"error":{"grpc_code":1,"http_code":408,"message":"context canceled","http_status":"Request Timeout"}}
The error is returned by your grpc-gateway, so you need to debug it firstly. Please let me know if you see any issue when you watch a key via etcd or grpc-proxy directly.
The watch error happens in this scenario:
Take grpc proxy away, all worked OK:
So I guess this indicates that the problem is with the grpc proxy.
from etcd.
The watch error happens in this scenario:
Do you still see the issue after applying the #18012?
from etcd.
The watch error happens in this scenario:
Do you still see the issue after applying the #18012?
After applying the #18012, all worked OK.
from etcd.
Related Issues (20)
- Server-level feature gate gRPC endpoints HOT 1
- When the long TCP connection between two nodes in the cluster is not disconnected, but data transmission is no longer possible through the connection, etcd will not perform a quick reconnection. HOT 9
- etcd watcher doesn't read older events HOT 2
- [Robustness tests] Etcd v3.6 can panic due to missing snapshot HOT 3
- Robustness test doesn't recover if etcd panics HOT 1
- Find a replacement for marker (markdown linter) HOT 7
- Add multiarch builds to prow build presubmit HOT 1
- Add integration tests to prow presubmit
- Performance Issue: CPU usage of the leader node increased by 20% HOT 13
- How to disable the /debug/vars feature in a Docker environment HOT 10
- invoke the Lock function in concurrency package will get stuck in when etcd servers are not available
- Missing nil check HOT 1
- Memory leak HOT 1
- etcd memory raise rapidly and never decline after exec get --prefix/range HOT 4
- Watch dropping an event when compacting on delete HOT 34
- Panic: index out of range[0] with length 0 at v3.5.11 go.etcd.io/etcd/client/v3/client.go:302 HOT 1
- Unable to register Arm64 runners HOT 8
- etcd panic: assertion failed: Page expected to be: 36312, but self identifies as 0 HOT 3
- The database file size of etcd has exceeded the configured quota HOT 2
- Make linearizable renew lease configurable HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from etcd.