abcxyz / abcxyz/abc-updater

Bad ABC_METRICS_URL causes SEGFAULT

Open
#105 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Go
Stars
1
Forks
0
PR merge metrics
No merged PRs in 30d

Description

### TL;DR

[Found in `abc`]

If you do
```shell
export ABC_METRICS_URL=""
abc # anyh command
```

You get

```shell
$ abc
metric client creation failed: failed to parse server URL: parse "": empty url
Usage: abc COMMAND

describe show the description and inputs of a given template
golden-test subcommands for validating template rendering with golden tests
render instantiate a template to setup a new app or add config files
templates subcommands for rendering templates and related things
upgrade apply a new template version to an already-rendered template output directory
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x38 pc=0xa6b3ac]

goroutine 38 [running]:
github.com/abcxyz/abc-updater/pkg/metrics.(*Client).WriteMetric(0x0?, {0xfacac0?, 0xc0002a4140?}, {0xe7783e?, 0x0?}, 0x0?)
/usr/local/google/home/pdewilde/go/pkg/mod/github.com/abcxyz/abc-updater@v0.3.0/pkg/metrics/metrics.go:212 +0x4c
github.com/abcxyz/abc/internal/metricswrap.WriteMetric.func1()
/usr/local/google/home/pdewilde/go/pkg/mod/github.com/abcxyz/abc@v0.10.0-alpha/internal/metricswrap/metrics.go:37 +0x71
created by github.com/abcxyz/abc/internal/metricswrap.WriteMetric in goroutine 1
/usr/local/google/home/pdewilde/go/pkg/mod/github.com/abcxyz/abc@v0.10.0-alpha/internal/metricswrap/metrics.go:34 +0xfe
```

### Expected behavior

Fail silently

### Observed behavior

Segfault

### Environment Details

```markdown
Linux, abc v0.10.0-alpha
```

### Additional information

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.