open-consul/agent/config
R.B. Boyer a01936442c
cache: refactor agent cache fetching to prevent unnecessary fetches on error (#14956)
This continues the work done in #14908 where a crude solution to prevent a
goroutine leak was implemented. The former code would launch a perpetual
goroutine family every iteration (+1 +1) and the fixed code simply caused a
new goroutine family to first cancel the prior one to prevent the
leak (-1 +1 == 0).

This PR refactors this code completely to:

- make it more understandable
- remove the recursion-via-goroutine strangeness
- prevent unnecessary RPC fetches when the prior one has errored.

The core issue arose from a conflation of the entry.Fetching field to mean:

- there is an RPC (blocking query) in flight right now
- there is a goroutine running to manage the RPC fetch retry loop

The problem is that the goroutine-leak-avoidance check would treat
Fetching like (2), but within the body of a goroutine it would flip that
boolean back to false before the retry sleep. This would cause a new
chain of goroutines to launch which #14908 would correct crudely.

The refactored code uses a plain for-loop and changes the semantics
to track state for "is there a goroutine associated with this cache entry"
instead of the former.

We use a uint64 unique identity per goroutine instead of a boolean so
that any orphaned goroutines can tell when they've been replaced when
the expiry loop deletes a cache entry while the goroutine is still running
and is later replaced.
2022-10-25 10:27:26 -05:00
..
testdata cache: refactor agent cache fetching to prevent unnecessary fetches on error (#14956) 2022-10-25 10:27:26 -05:00
agent_limits.go config: validate system limits against limits.http_max_conns_per_client (#7434) 2020-04-02 09:22:17 +02:00
builder.go Refactor client RPC timeouts (#14965) 2022-10-18 15:05:09 -04:00
builder_oss.go re-run gofmt on 1.17 (#11579) 2021-11-16 12:04:01 -06:00
builder_oss_test.go Rename `master` and `agent_master` ACL tokens in the config file format (#11665) 2021-12-01 21:08:14 +00:00
builder_test.go fix: missing UDP field in checkType (#14885) 2022-10-05 15:57:21 -04:00
config.go Refactor client RPC timeouts (#14965) 2022-10-18 15:05:09 -04:00
config_oss.go Fixup acl.EnterpriseMeta 2022-04-05 15:11:49 -07:00
default.go Refactor client RPC timeouts (#14965) 2022-10-18 15:05:09 -04:00
default_oss.go re-run gofmt on 1.17 (#11579) 2021-11-16 12:04:01 -06:00
deprecated.go config: prevent top-level `verify_incoming` enabling mTLS on gRPC port (#13118) 2022-05-18 16:15:57 +01:00
deprecated_test.go config: prevent top-level `verify_incoming` enabling mTLS on gRPC port (#13118) 2022-05-18 16:15:57 +01:00
doc.go Metrics service prefix (#3498) 2017-09-26 17:49:55 -07:00
file_watcher.go Regenerate files according to 1.19.2 formatter 2022-10-24 16:12:08 -04:00
file_watcher_test.go add a rate limiter to config auto-reload (#12490) 2022-04-04 11:31:39 -04:00
flags.go Add separate grpc_tls port. 2022-08-29 13:43:43 -05:00
flags_test.go Revert "Merge pull request #10588 from hashicorp/dnephin/config-fix-ports-grpc" 2021-09-29 12:28:41 -04:00
flagset.go
golden_test.go config: Use golden for TestRuntimeConfig_Sanitize 2021-01-11 14:34:03 -05:00
limits.go re-run gofmt on 1.17 (#11579) 2021-11-16 12:04:01 -06:00
limits_windows.go re-run gofmt on 1.17 (#11579) 2021-11-16 12:04:01 -06:00
merge.go Agent Auto Configuration: Configuration Syntax Updates (#8003) 2020-06-16 15:03:22 -04:00
merge_test.go config: Introduce DeprecatedConfig 2021-09-22 13:22:16 -04:00
ratelimited_file_watcher.go add a rate limiter to config auto-reload (#12490) 2022-04-04 11:31:39 -04:00
ratelimited_file_watcher_test.go add a rate limiter to config auto-reload (#12490) 2022-04-04 11:31:39 -04:00
runtime.go Refactor client RPC timeouts (#14965) 2022-10-18 15:05:09 -04:00
runtime_oss.go re-run gofmt on 1.17 (#11579) 2021-11-16 12:04:01 -06:00
runtime_oss_test.go Add awareness of server mode to TLS configurator 2022-09-16 17:57:10 -06:00
runtime_test.go Refactor client RPC timeouts (#14965) 2022-10-18 15:05:09 -04:00
segment_oss.go re-run gofmt on 1.17 (#11579) 2021-11-16 12:04:01 -06:00
segment_oss_test.go re-run gofmt on 1.17 (#11579) 2021-11-16 12:04:01 -06:00