From bebefd8b80acb92ccfb34d2bc3bd1c723a700252 Mon Sep 17 00:00:00 2001 From: spacewander Date: Tue, 16 Aug 2022 11:33:01 +0800 Subject: [PATCH] chore: log when an invalid watch request is received 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 --- server/etcdserver/api/v3rpc/watch.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server/etcdserver/api/v3rpc/watch.go b/server/etcdserver/api/v3rpc/watch.go index 00b68cdbf..abd9b99a7 100644 --- a/server/etcdserver/api/v3rpc/watch.go +++ b/server/etcdserver/api/v3rpc/watch.go @@ -346,8 +346,9 @@ func (sws *serverWatchStream) recvLoop() error { } default: // we probably should not shutdown the entire stream when - // receive an valid command. + // receive an invalid command. // so just do nothing instead. + sws.lg.Warn("invalid watch request received in gRPC stream") continue } }