Go to file
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
.changelog cache: refactor agent cache fetching to prevent unnecessary fetches on error (#14956) 2022-10-25 10:27:26 -05:00
.circleci Remove rsyslog from CI steps 2022-10-24 16:12:08 -04:00
.github Update go version to 1.19 2022-10-24 16:12:08 -04:00
.release Enable ironbank integration (#14931) 2022-10-11 10:27:06 -04:00
acl Regenerate files according to 1.19.2 formatter 2022-10-24 16:12:08 -04:00
agent cache: refactor agent cache fetching to prevent unnecessary fetches on error (#14956) 2022-10-25 10:27:26 -05:00
api Regenerate files according to 1.19.2 formatter 2022-10-24 16:12:08 -04:00
bench
build-support Update go version to 1.19 2022-10-24 16:12:08 -04:00
command test: ensure that all dependencies in a test agent use the test logger (#14996) 2022-10-24 17:02:38 -05:00
connect Regenerate files according to 1.19.2 formatter 2022-10-24 16:12:08 -04:00
contributing
docs
grafana
internal Regenerate files according to 1.19.2 formatter 2022-10-24 16:12:08 -04:00
ipaddr
lib Regenerate files according to 1.19.2 formatter 2022-10-24 16:12:08 -04:00
logging Regenerate files according to 1.19.2 formatter 2022-10-24 16:12:08 -04:00
proto Regenerate files according to 1.19.2 formatter 2022-10-24 16:12:08 -04:00
proto-public Regenerate files according to 1.19.2 formatter 2022-10-24 16:12:08 -04:00
sdk Regenerate files according to 1.19.2 formatter 2022-10-24 16:12:08 -04:00
sentinel
service_os
snapshot
test Update go version to 1.19 2022-10-24 16:12:08 -04:00
testrpc
tlsutil
tools/internal-grpc-proxy
types
ui fix: customize eai publicAssetURL in production 2022-10-24 14:28:58 +02:00
version chore: update main for release/1.14.x branch 2022-10-21 15:50:51 -04:00
website Merge pull request #15141 from hashicorp/docs/upgrade-vault-ca-provider-policy-guidance 2022-10-24 17:34:43 -04:00
.dockerignore
.gitattributes
.gitignore
.golangci.yml Ignore ioutil linter messages 2022-10-24 16:12:08 -04:00
CHANGELOG.md changelog: update Vault CA provider policy guidance 2022-10-24 14:26:14 -07:00
Dockerfile
GNUmakefile chore: update golangci-lint to v1.50.1 (#15022) 2022-10-24 11:48:02 -05:00
LICENSE
NOTICE.md
README.md Fixed broken links referring to tutorials running as local agent (#14954) 2022-10-11 13:01:29 -07:00
Vagrantfile
fixup_acl_move.sh
go.mod Update go version to 1.19 2022-10-24 16:12:08 -04:00
go.sum Update go-memdb to fix a goroutine leak 2022-10-20 14:32:42 -04:00
main.go

README.md

Consul logo Consul

Docker Pulls Go Report Card

Consul is a distributed, highly available, and data center aware solution to connect and configure applications across dynamic, distributed infrastructure.

Consul provides several key features:

  • Multi-Datacenter - Consul is built to be datacenter aware, and can support any number of regions without complex configuration.

  • Service Mesh - Consul Service Mesh enables secure service-to-service communication with automatic TLS encryption and identity-based authorization. Applications can use sidecar proxies in a service mesh configuration to establish TLS connections for inbound and outbound connections with Transparent Proxy.

  • Service Discovery - Consul makes it simple for services to register themselves and to discover other services via a DNS or HTTP interface. External services such as SaaS providers can be registered as well.

  • Health Checking - Health Checking enables Consul to quickly alert operators about any issues in a cluster. The integration with service discovery prevents routing traffic to unhealthy hosts and enables service level circuit breakers.

  • Key/Value Storage - A flexible key/value store enables storing dynamic configuration, feature flagging, coordination, leader election and more. The simple HTTP API makes it easy to use anywhere.

Consul runs on Linux, macOS, FreeBSD, Solaris, and Windows and includes an optional browser based UI. A commercial version called Consul Enterprise is also available.

Please note: We take Consul's security and our users' trust very seriously. If you believe you have found a security issue in Consul, please responsibly disclose by contacting us at security@hashicorp.com.

Quick Start

A few quick start guides are available on the Consul website:

Documentation

Full, comprehensive documentation is available on the Consul website: https://consul.io/docs

Contributing

Thank you for your interest in contributing! Please refer to CONTRIBUTING.md for guidance. For contributions specifically to the browser based UI, please refer to the UI's README.md for guidance.