etcd icon indicating copy to clipboard operation
etcd copied to clipboard

Revision in response header might not reflect data in the body

Open lavacat opened this issue 3 years ago • 2 comments

What happened?

Related to https://github.com/etcd-io/etcd/pull/13940

In LeaseLeases function, newHeader is called at the end and there is no synchronization. https://github.com/etcd-io/etcd/blob/main/server/etcdserver/v3_server.go#L399

This can cause a situation when list of leases in the body doesn't include new lease reported by revision in the header.

The same is true for any other function that's using newHeader

What did you expect to happen?

Expected Revision in the header to be the latest revision among return leases

How can we reproduce it (as minimally and precisely as possible)?

might be hard to reproduce try running TestLeaseGrantAndList

Anything else we need to know?

No response

Etcd version (please run commands below)

3.6 latest main branch

Etcd configuration (command line flags or environment variables)

paste your configuration here

Etcd debug information (please run commands blow, feel free to obfuscate the IP address or FQDN in the output)

$ etcdctl member list -w table
# paste output here

$ etcdctl --endpoints=<member list> endpoint status -w table
# paste output here

Relevant log output

No response

lavacat avatar Apr 25 '22 17:04 lavacat

Not sure there is nice fix for this. If we move newHeader to the start of the function, the problem is reversed.

IMO, revision in the header should be the latest revision in the data

lavacat avatar Apr 25 '22 17:04 lavacat

This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 21 days if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jul 31 '22 06:07 stale[bot]