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

linkerd 2.9.0 cli segfault #5215

Closed
airkewld opened this issue Nov 11, 2020 · 6 comments · Fixed by #5269
Closed

linkerd 2.9.0 cli segfault #5215

airkewld opened this issue Nov 11, 2020 · 6 comments · Fixed by #5269
Assignees
Labels
Milestone

Comments

@airkewld
Copy link

Issue posted on slack channel and asked to open an issuer here.

kubectl version --short; linkerd version; linkerd check config; linkerd check --proxy
Client Version: v1.18.8
Server Version: v1.18.8
Client version: stable-2.9.0
Server version: stable-2.9.0
kubernetes-api
--------------
√ can initialize the client
√ can query the Kubernetes API
kubernetes-version
------------------
√ is running the minimum Kubernetes API version
√ is running the minimum kubectl version
linkerd-config
--------------
√ control plane Namespace exists
√ control plane ClusterRoles exist
√ control plane ClusterRoleBindings exist
√ control plane ServiceAccounts exist
√ control plane CustomResourceDefinitions exist
√ control plane MutatingWebhookConfigurations exist
√ control plane ValidatingWebhookConfigurations exist
√ control plane PodSecurityPolicies exist
linkerd-version
---------------
√ can determine the latest version
√ cli is up-to-date
Status check results are √
kubernetes-api
--------------
√ can initialize the client
√ can query the Kubernetes API
kubernetes-version
------------------
√ is running the minimum Kubernetes API version
√ is running the minimum kubectl version
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0xf1 pc=0x222eed3]
goroutine 1 [running]:
github.com/linkerd/linkerd2/pkg/healthcheck.(*HealthChecker).allCategories.func24(0x2995f80, 0xc0000e17a0, 0x6fc23ac00, 0x2995f80)
	/linkerd-build/pkg/healthcheck/healthcheck.go:622 +0x93
github.com/linkerd/linkerd2/pkg/healthcheck.(*HealthChecker).runCheck(0xc0003f2c40, 0x26c7e23, 0x11, 0xc000651ab0, 0xc000651be8, 0xc00058b700)
	/linkerd-build/pkg/healthcheck/healthcheck.go:1520 +0x14c
github.com/linkerd/linkerd2/pkg/healthcheck.(*HealthChecker).RunChecks(0xc0003f2c40, 0xc000651be8, 0x4)
	/linkerd-build/pkg/healthcheck/healthcheck.go:1489 +0x298
github.com/linkerd/linkerd2/cli/cmd.runChecksTable(0x2950ac0, 0xc000120008, 0xc0003f2c40, 0x0)
	/linkerd-build/cli/cmd/check.go:276 +0x12b
github.com/linkerd/linkerd2/cli/cmd.runChecks(0x2950ac0, 0xc000120008, 0x2950ac0, 0xc000120010, 0xc0003f2c40, 0x26b81d5, 0x5, 0x3)
	/linkerd-build/cli/cmd/check.go:230 +0x5b
github.com/linkerd/linkerd2/cli/cmd.configureAndRunChecks(0x2995f40, 0xc000126010, 0x2950ac0, 0xc000120008, 0x2950ac0, 0xc000120010, 0x0, 0x0, 0xc00058cba0, 0x0, ...)
	/linkerd-build/cli/cmd/check.go:217 +0x5c1
github.com/linkerd/linkerd2/cli/cmd.newCmdCheck.func1(0xc0002c7080, 0xc000c87a30, 0x0, 0x1, 0x0, 0x0)
	/linkerd-build/cli/cmd/check.go:138 +0x83
github.com/spf13/cobra.(*Command).execute(0xc0002c7080, 0xc000c87a20, 0x1, 0x1, 0xc0002c7080, 0xc000c87a20)
	/go/pkg/mod/github.com/spf13/cobra@v1.0.0/command.go:842 +0x453
github.com/spf13/cobra.(*Command).ExecuteC(0x3728ba0, 0x0, 0x23d8d40, 0xc00010c058)
	/go/pkg/mod/github.com/spf13/cobra@v1.0.0/command.go:950 +0x349
github.com/spf13/cobra.(*Command).Execute(...)
	/go/pkg/mod/github.com/spf13/cobra@v1.0.0/command.go:887
main.main()
	/linkerd-build/cli/main.go:10 +0x2d
@olix0r olix0r transferred this issue from linkerd/linkerd Nov 11, 2020
@olix0r olix0r changed the title linkerd 2.9.0 cli issues linkerd 2.9.0 cli segfault Nov 11, 2020
@Pothulapati
Copy link
Contributor

@airkewld 👋

I could not replicate this issue. Did you have any special configuration during the first linkerd initialization i.e cni, etc?

@airkewld
Copy link
Author

@Pothulapati 👋
I do have a custom deployment using kustomize and my own certs.
After refactoring our deployment, i noticed the content of linkerd-config changed from 2.8.1; specifically the tracing section.
Previously i specified which technology i wanted to use for tracing, but looks like now the only available option is
tracing:
enabled: true

This can be closed.

@olix0r
Copy link
Member

olix0r commented Nov 12, 2020

Still, we shouldn't segfault if the config doesn't match our expectations..

@olix0r
Copy link
Member

olix0r commented Nov 12, 2020

hc.uuid, hc.linkerdConfig, err = hc.checkLinkerdConfigConfigMap(ctx)
if hc.linkerdConfig != nil {
hc.CNIEnabled = hc.linkerdConfig.Global.CNIEnabled
}
return

I assume this error is caused by the ...Global... when Global is nil -- we should either provide safe accessors (i.e. a function, Global(), that returns an empty global object if it's unset, or add explicit nil-checking everywhere we do this sort of thing...

OR... we could rewrite the CLI in Rust, where sort of runtime panic would be much harder to hit 🤓

@airkewld
Copy link
Author

airkewld commented Nov 12, 2020

Yes, i do agree with that.

This is the linkerd-config.yaml i had defined

kind: ConfigMap
apiVersion: v1
metadata:
  name: linkerd-config
  namespace: linkerd
data:
  values: |-
    tracing:
      collector:
        name: linkerd-collector
      enabled: false
      jaeger:
        name: linkerd-jaeger
      enabled: true

After removing that from my kustomize template, everything worked out fine.

@Pothulapati
Copy link
Contributor

Pothulapati commented Nov 12, 2020

@airkewld This was a kustomize template before? At 2.8, we did not have the add-on configuration in linkerd-config but instead in linkerd-config-addons. If you want to override configuration both linkerd2's and that of add-ons, we have --config in 2.9 to allow you to do that without having to use kustomize!

This seems to have happened because global was not there as @olix0r mentioned in the linkerd-config which is definitely present in all cases as it contains the core linkerd2 configuration. I like the idea of having accessors though! 🤔

hodbn added a commit to hodbn/linkerd2 that referenced this issue Nov 21, 2020
Fix linkerd#5215.
Add a safe accessor that initializes an empty Global on the first
access. Refactor all accesses to use the newly introduced accessor using
gopls.

Co-authored-by: Itai Schwartz <yitai27@gmail.com>
hodbn added a commit to hodbn/linkerd2 that referenced this issue Nov 21, 2020
CLI crashes if linkerd-config contains unexpected values.

Add a safe accessor that initializes an empty Global on the first
access. Refactor all accesses to use the newly introduced accessor using
gopls.

Add test for linkerd-config data without Global.

Fixes linkerd#5215

Co-authored-by: Itai Schwartz <yitai27@gmail.com>
Signed-off-by: Hod Bin Noon <bin.noon.hod@gmail.com>
@hodbn hodbn mentioned this issue Nov 21, 2020
hodbn added a commit to hodbn/linkerd2 that referenced this issue Nov 21, 2020
CLI crashes if linkerd-config contains unexpected values.

Add a safe accessor that initializes an empty Global on the first
access. Refactor all accesses to use the newly introduced accessor using
gopls.

Add test for linkerd-config data without Global.

Fixes linkerd#5215

Co-authored-by: Itai Schwartz <yitai27@gmail.com>
Signed-off-by: Hod Bin Noon <bin.noon.hod@gmail.com>
hodbn added a commit to hodbn/linkerd2 that referenced this issue Nov 21, 2020
CLI crashes if linkerd-config contains unexpected values.

Add a safe accessor that initializes an empty Global on the first
access. Refactor all accesses to use the newly introduced accessor using
gopls.

Add test for linkerd-config data without Global.

Fixes linkerd#5215

Co-authored-by: Itai Schwartz <yitai27@gmail.com>
Signed-off-by: Hod Bin Noon <bin.noon.hod@gmail.com>
adleong pushed a commit that referenced this issue Nov 23, 2020
CLI crashes if linkerd-config contains unexpected values.

Add a safe accessor that initializes an empty Global on the first
access. Refactor all accesses to use the newly introduced accessor using
gopls.

Add test for linkerd-config data without Global.

Fixes #5215

Co-authored-by: Itai Schwartz <yitai27@gmail.com>
Signed-off-by: Hod Bin Noon <bin.noon.hod@gmail.com>
alpeb pushed a commit that referenced this issue Nov 30, 2020
CLI crashes if linkerd-config contains unexpected values.

Add a safe accessor that initializes an empty Global on the first
access. Refactor all accesses to use the newly introduced accessor using
gopls.

Add test for linkerd-config data without Global.

Fixes #5215

Co-authored-by: Itai Schwartz <yitai27@gmail.com>
Signed-off-by: Hod Bin Noon <bin.noon.hod@gmail.com>
alpeb pushed a commit that referenced this issue Dec 1, 2020
CLI crashes if linkerd-config contains unexpected values.

Add a safe accessor that initializes an empty Global on the first
access. Refactor all accesses to use the newly introduced accessor using
gopls.

Add test for linkerd-config data without Global.

Fixes #5215

Co-authored-by: Itai Schwartz <yitai27@gmail.com>
Signed-off-by: Hod Bin Noon <hodbn@users.noreply.github.com>
alpeb pushed a commit that referenced this issue Dec 1, 2020
CLI crashes if linkerd-config contains unexpected values.

Add a safe accessor that initializes an empty Global on the first
access. Refactor all accesses to use the newly introduced accessor using
gopls.

Add test for linkerd-config data without Global.

Fixes #5215

Co-authored-by: Itai Schwartz <yitai27@gmail.com>
Signed-off-by: hodbn <hodbn@users.noreply.github.com>
alpeb pushed a commit that referenced this issue Dec 1, 2020
CLI crashes if linkerd-config contains unexpected values.

Add a safe accessor that initializes an empty Global on the first
access. Refactor all accesses to use the newly introduced accessor using
gopls.

Add test for linkerd-config data without Global.

Fixes #5215

Co-authored-by: Itai Schwartz <yitai27@gmail.com>
Signed-off-by: hodbn <hodbn@users.noreply.github.com>
GMarkfjard pushed a commit to GMarkfjard/linkerd2 that referenced this issue Dec 2, 2020
CLI crashes if linkerd-config contains unexpected values.

Add a safe accessor that initializes an empty Global on the first
access. Refactor all accesses to use the newly introduced accessor using
gopls.

Add test for linkerd-config data without Global.

Fixes linkerd#5215

Co-authored-by: Itai Schwartz <yitai27@gmail.com>
Signed-off-by: Hod Bin Noon <bin.noon.hod@gmail.com>
alpeb added a commit that referenced this issue Dec 4, 2020
* proxy: v2.119.0 (#5200)

This release modifies the default idle timeout to 5s for outbound
clients and 20s for inbound clients. This prevents idle clients from
consuming memory at the cost of performing more discovery resolutions
for periodic but infrequent traffic. This is intended to reduce the
proxy's memory footprint, especially on Prometheus instances.

The proxy's *ring* and rustls dependencies have also been updated.

---

* Update *ring* and rustls dependencies (linkerd/linkerd2-proxy#735)
* http: Configure client connection pools (linkerd/linkerd2-proxy#734)

* cli: Remove get cmd and relevant tests (#5202)

Fixes #5190

`linkerd get` is not used currently and works only for pods. This can be
removed instead as per the issue. This branch removes the command and
also the associated unit and integration tests.

Signed-off-by: Tarun Pothulapati <tarunpothulapati@outlook.com>

* cli: remove logs subcommand and tests (#5203)

Fixes #5191

The logs command adds a external dependency that we forked to work but
does not fit within linkerd's core set of responsibilities. Hence, This
is being removed.

For capabilities like this, The Kubernetes plugin ecosystem has better
and well maintained tools that can be used.

Signed-off-by: Tarun Pothulapati <tarunpothulapati@outlook.com>

* Remove logs comparisons in integration tests (#5223)

The rare cases where these tests were useful don't make up for the burden of
maintaing them, having different k8s version change the messages and
having unexpected warnings come up that didn't affect the final
convergence of the system.

With this we also revert the indirection added back in #4538 that
fetched unmatched warnings after a test had failed.

* Add endpoint to GetProfile response (#5227)

Context: #5209

This updates the destination service to set the `Endpoint` field in `GetProfile`
responses.

The `Endpoint` field is only set if the IP maps to a Pod--not a Service.

Additionally in this scenario, the default Service Profile is used as the base
profile so no other significant fields are set.

### Examples

```
# GetProfile for an IP that maps to a Service
❯ go run controller/script/destination-client/main.go -method getProfile -path 10.43.222.0:9090
INFO[0000] fully_qualified_name:"linkerd-prometheus.linkerd.svc.cluster.local"  retry_budget:{retry_ratio:0.2  min_retries_per_second:10  ttl:{seconds:10}}  dst_overrides:{authority:"linkerd-prometheus.linkerd.svc.cluster.local.:9090"  weight:10000}
```

Before:

```
# GetProfile for an IP that maps to a Pod
❯ go run controller/script/destination-client/main.go -method getProfile -path 10.42.0.20
INFO[0000] retry_budget:{retry_ratio:0.2 min_retries_per_second:10 ttl:{seconds:10}}
```

After:

```
# GetProfile for an IP that maps to a Pod
❯ go run controller/script/destination-client/main.go -method getProfile -path 10.42.0.20
INFO[0000] retry_budget:{retry_ratio:0.2  min_retries_per_second:10  ttl:{seconds:10}}  endpoint:{addr:{ip:{ipv4:170524692}}  weight:10000  metric_labels:{key:"control_plane_ns"  value:"linkerd"}  metric_labels:{key:"deployment"  value:"fast-1"}  metric_labels:{key:"pod"  value:"fast-1-5cc87f64bc-9hx7h"}  metric_labels:{key:"pod_template_hash"  value:"5cc87f64bc"}  metric_labels:{key:"serviceaccount"  value:"default"}  tls_identity:{dns_like_identity:{name:"default.default.serviceaccount.identity.linkerd.cluster.local"}}  protocol_hint:{h2:{}}}
```

Signed-off-by: Kevin Leimkuhler <kevin@kleimkuhler.com>

* cli: Fix custom namespace installation (#5241)

The `--linkerd-namespace` flag was not honored by the `install`
command. This change updates the install templating to use the
value of this flag.

* cli: Don't check for SAN in root and intermediate certs (#5237)

As discussed in #5228, it is not correct for root and intermediate
certs to have SAN. This PR updates the check to not verify the
intermediate issuer cert with the identity dns name (which checks with
SAN and not CN as the the `verify` func is used to verify leaf certs and
not root and intermediate certs). This PR also avoids setting a SAN
field when generating certs in the `install` command.

Fixes #5228

* proxy: v2.121.0 (#5253)

This release changes error handling to teardown the server-side
connection when an unexpected error is encountered.

Additionally, the outbound TCP routing stack can now skip redundant
service discovery lookups when profile responses include endpoint
information.

Finally, the cache implementation has been updated to reduce latency by
removing unnecessary buffers.

---

* h2: enable HTTP/2 keepalive PING frames (linkerd/linkerd2-proxy#737)
* actions: Add timeouts to GitHub actions (linkerd/linkerd2-proxy#738)
* outbound: Skip endpoint resolution on profile hint (linkerd/linkerd2-proxy#736)
* Add a FromStr for dns::Name (linkerd/linkerd2-proxy#746)
* outbound: Avoid redundant TCP endpoint resolution (linkerd/linkerd2-proxy#742)
* cache: Make the cache cloneable with RwLock (linkerd/linkerd2-proxy#743)
* http: Teardown serverside connections on error (linkerd/linkerd2-proxy#747)

* Check correct label value when setting protocl hint (#5267)

This fixes an issue where the protocol hint is always set on endpoint responses.
We now check the right value which determines if the pod has the required label.

A test for this has been added to #5266.

Signed-off-by: Kevin Leimkuhler <kevin@kleimkuhler.com>

* Add safe accessor for Global in linkerd-config (#5269)

CLI crashes if linkerd-config contains unexpected values.

Add a safe accessor that initializes an empty Global on the first
access. Refactor all accesses to use the newly introduced accessor using
gopls.

Add test for linkerd-config data without Global.

Fixes #5215

Co-authored-by: Itai Schwartz <yitai27@gmail.com>
Signed-off-by: hodbn <hodbn@users.noreply.github.com>

* proxy: v2.122.0 (#5279)

This release addresses some issues reported around clients seeing
max-concurrency errors by increasing the default in-flight request limit
to 100K pending requests.

Additionally, the proxy now sets an appropriate content-type when
synthesizing gRPC error responses.

---

* style: fix some random clippy lints (linkerd/linkerd2-proxy#749)
* errors: Set `content-type` for synthesized grpc errors (linkerd/linkerd2-proxy#750)
* concurrency-limit: Drop permit on readiness (linkerd/linkerd2-proxy#751)
* Increase the default buffer capacity to 100K (linkerd/linkerd2-proxy#752)
* Change default max-in-flight and buffer-capacity (linkerd/linkerd2-proxy#753)

* proxy: v2.123.0 (#5301)

This release removes a potential panic: it was assumed that looking up a
socket's peer address was infallible, but in practice this call can
fail when a host is under high load. Now these failures only impact the
connection-level task and not the whole proxy proces.

Also, the `process_cpu_seconds_total` metric is now exposed as a float
so that its value may include fractional seconds with 10ms granularity.

---

* io: Make peer_addr fallible (linkerd/linkerd2-proxy#755)
* metrics: Expose process_cpu_seconds_total as a float (linkerd/linkerd2-proxy#754)

* Release notes for stable-2.9.1

## stable-2.9.1

This stable release contains a number of proxy enhancements: better support for
high-traffic workloads, improved performance by eliminating unnecessary endpoint
resolutions for TCP traffic and properly tearing down serverside connections
when errors occur, and reduced memory consumption on proxies which maintain many
idle connections (such as Prometheus' proxy).

On the CLI and control plane sides, it relaxes checks on root and intermediate
certificates (following X509 best practices), and fixes two issues: one that
prevented installation of the control plane into a custom namespace and one
which failed to update endpoint information when a headless service was
modified.

* Proxy:
  * Addressed some issues reported around clients seeing max-concurrency errors
    by increasing the default in-flight request limit to 100K pending requests
  * Reduced the default idle connection timeout to 5s for outbound clients and
    for inbound clients to reduce the proxy's memory footprint, especially on
      Prometheus instances
  * Fixed an issue where the proxy did not receive updated endpoint information
    when a headless service was modified
  * Added HTTP/2 keepalive PING frames
  * Removed logic to avoid redundant TCP endpoint resolution
  * Fixed an issue where serverside connections were not torn down when an error
    occurred

* CLI / Control Plane:
  * Fixed a CLI issue where the `linkerd-namespace` flag was not honored when
    passed to the `install` and `upgrade` commands
  * Updated `linkerd check` so that it doesn't attempt to validate the subject
    alternative name (SAN) on root and intermediate certificates. SANs for leaf
    certificates will continue to be validated
  * Fixed an issue in the destination service where endpoints always included a
    protocol hint, regardless of the controller label being present or not
  * Removed the `get` and `logs` command from the CLI
  * No longer panic in rare cases when `linkerd-config` doesn't have an entry
    for `Global` configs (thanks @hodbn!)

* proxy: v2.124.0 (#5323)

This release updates the proxy's `*ring*` dependency to pick up the
latest changes from BoringSSL.

Additionally, we've audited uses of non-cryptographic random number
generators in the proxy to ensure that each balancer/router intializes
its own RNG state.

---

* Audit uses of SmallRng (linkerd/linkerd2-proxy#757)
* Update *ring* to 0.6.19 (linkerd/linkerd2-proxy#758)
* metrics: Support the Summary metric type (linkerd/linkerd2-proxy#756)

Co-authored-by: Oliver Gould <ver@buoyant.io>
Co-authored-by: Tarun Pothulapati <tarunpothulapati@outlook.com>
Co-authored-by: Kevin Leimkuhler <kevin@kleimkuhler.com>
Co-authored-by: hodbn <hodbn@users.noreply.github.com>
Co-authored-by: Itai Schwartz <yitai27@gmail.com>
@olix0r olix0r added this to the stable-2.10 milestone Jan 11, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants