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

Backport of Fix KVSGet method to handle QueryOptions properly into release/1.12.x #13348

Conversation

hc-github-team-consul-core
Copy link
Contributor

Backport

This PR is auto-generated from #13344 to be assessed for backporting due to the inclusion of the label backport/1.12.

The below text is copied from the body of the original PR.


Fixes #13303

Description

Originally reported by @wjordan here, I requested the bugfix be removed from #11500 assuming it was a separate issue. Unfortunately it turns out that broke KVS.Get RPC operations in 1.12.1.

Cause

The KV.Get endpoint was being passed **structs.KeyRequest, which when handled by a client's RPC method, was not fulfilling this assertion:

consul/agent/pool/pool.go

Lines 632 to 635 in c48120d

// Use the zero value if the request doesn't implement RPCInfo
if info, ok := args.(structs.RPCInfo); ok {
sc.stream.FirstReadTimeout = info.Timeout(p.Timeout, p.MaxQueryTime, p.DefaultQueryTime)
}

causing the ReadTimeout to be set to the default value of rpc_hold_timeout (source).

Testing & Reproduction steps

Set up a cluster with server and client using vagrant.

# 1.12.1
$ consul join 192.168.56.10
Successfully joined cluster by contacting 1 nodes.

$ consul members
Node       Address             Status  Type    Build   Protocol  DC   Partition  Segment
agent-one  192.168.56.10:8301  alive   server  1.12.1  2         dc1  default    <all>
agent-two  192.168.56.11:8301  alive   client  1.12.1  2         dc1  default    <default>

$ consul kv put test foo
Success! Data written to: test

$ time curl "http://localhost:8500/v1/kv/test"
[{"LockIndex":0,"Key":"test","Flags":0,"Value":"Zm9v","CreateIndex":11,"ModifyIndex":11}]
real	0m0.013s
user	0m0.000s
sys	0m0.004s

$ time curl "http://localhost:8500/v1/kv/test?index=99&stale=&wait=60000ms"
rpc error making call: i/o deadline reached
real	0m7.013s <- deadline of rpc_hold_timeout
user	0m0.004s
sys	0m0.000s
# 1.13.0dev patch (version comes from main; ignore)
$ consul join 192.168.56.10
Successfully joined cluster by contacting 1 nodes.

$ consul members
Node       Address             Status  Type    Build      Protocol  DC   Partition  Segment
agent-one  192.168.56.10:8301  alive   server  1.12.1     2         dc1  default    <all>
agent-two  192.168.56.11:8301  alive   client  1.13.0dev  2         dc1  default    <default>

$ consul kv put test foo
Success! Data written to: test

$ time curl "http://localhost:8500/v1/kv/test"
[{"LockIndex":0,"Key":"test","Flags":0,"Value":"Zm9v","CreateIndex":12,"ModifyIndex":12}]
real	0m0.044s
user	0m0.012s
sys	0m0.004s

$ time curl "http://localhost:8500/v1/kv/test?index=99&stale=&wait=60000ms"
[{"LockIndex":0,"Key":"test","Flags":0,"Value":"Zm9v","CreateIndex":12,"ModifyIndex":12}]
real	1m2.708s <- wait=60000ms correctly applied
user	0m0.008s
sys	0m0.000s

@hc-github-team-consul-core hc-github-team-consul-core force-pushed the backport/kisunji/kvblockingfix/annually-pleasant-stag branch from 8c23e9c to 41545af Compare June 2, 2022 16:26
@hc-github-team-consul-core hc-github-team-consul-core merged commit 67310df into release/1.12.x Jun 2, 2022
@hc-github-team-consul-core hc-github-team-consul-core deleted the backport/kisunji/kvblockingfix/annually-pleasant-stag branch June 2, 2022 16:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant