service/rpccommon: print error when we can't decode request body (#4247)

Instead of shutting down the connection without doing saying anything
we should print an error, send an error response and try to continue
serving the connection.
This commit is contained in:
Alessandro Arzilli 2026-01-29 00:50:05 +01:00 committed by GitHub
parent 1f92901278
commit 69f247c34f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -238,7 +238,9 @@ func (s *ServerImpl) serveJSONCodec(conn io.ReadWriteCloser) {
}
// argv guaranteed to be a pointer now.
if err = codec.ReadRequestBody(argv.Interface()); err != nil {
return
s.log.Errorf("can't read request body: %v", err)
s.sendResponse(sending, &req, &rpc.Response{}, nil, codec, fmt.Sprintf("malformed request body: %v", err))
continue
}
if argIsValue {
argv = argv.Elem()