Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: log when an invalid watch request is received #14351

Merged
merged 2 commits into from
Aug 18, 2022

Conversation

spacewander
Copy link
Contributor

As protobuf doesn't have required field, user may send an empty
WatchRequest by mistake. Currently, etcd will ignore the invalid request
and keep the stream opening. If we don't reject the invalid request by
closing the stream, it would be better to leave a log there.

This commit also fixes a typo in the comment.

Signed-off-by: spacewander [email protected]

Please read https://github.com/etcd-io/etcd/blob/main/CONTRIBUTING.md#contribution-flow.

As protobuf doesn't have required field, user may send an empty
WatchRequest by mistake. Currently, etcd will ignore the invalid request
and keep the stream opening. If we don't reject the invalid request by
closing the stream, it would be better to leave a log there.

This commit also fixes a typo in the comment.

Signed-off-by: spacewander <[email protected]>
@codecov-commenter
Copy link

codecov-commenter commented Aug 16, 2022

Codecov Report

Merging #14351 (508ce51) into main (22cc682) will decrease coverage by 0.06%.
The diff coverage is 0.00%.

@@            Coverage Diff             @@
##             main   #14351      +/-   ##
==========================================
- Coverage   75.39%   75.33%   -0.07%     
==========================================
  Files         457      457              
  Lines       37125    37117       -8     
==========================================
- Hits        27991    27961      -30     
- Misses       7377     7394      +17     
- Partials     1757     1762       +5     
Flag Coverage Δ
all 75.33% <0.00%> (-0.07%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
server/etcdserver/api/v3rpc/watch.go 85.28% <0.00%> (-1.97%) ⬇️
server/etcdserver/api/membership/store.go 50.00% <0.00%> (-10.00%) ⬇️
client/pkg/v3/fileutil/lock_linux.go 72.22% <0.00%> (-8.34%) ⬇️
api/v3rpc/rpctypes/error.go 84.61% <0.00%> (-5.87%) ⬇️
raft/rafttest/node.go 95.00% <0.00%> (-5.00%) ⬇️
server/storage/wal/file_pipeline.go 90.69% <0.00%> (-4.66%) ⬇️
client/v3/concurrency/session.go 88.63% <0.00%> (-4.55%) ⬇️
server/etcdserver/api/v3rpc/util.go 70.96% <0.00%> (-3.23%) ⬇️
server/etcdserver/api/v3rpc/interceptor.go 74.47% <0.00%> (-3.13%) ⬇️
server/etcdserver/api/rafthttp/pipeline.go 97.40% <0.00%> (-2.60%) ⬇️
... and 18 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

// so just do nothing instead.
sws.lg.Warn("invalid watch request received in gRPC stream")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding the request type info will be more helpful to debug.

// so just do nothing instead.
sws.lg.Warn("invalid watch request received in gRPC stream")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@spacewander thanks! Logging it for information purpose sounds good, and so I think the severity should be Info (not warning).

@spacewander
Copy link
Contributor Author

@spzala @SimFG
Updated.

Copy link
Member

@ahrtr ahrtr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Thank you @spacewander

@ahrtr ahrtr merged commit 27ffd7e into etcd-io:main Aug 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

5 participants