equinix-labs / equinix-labs/otel-cli

otel-cli --tp-carrier should flock() the file around writes

Open
#80 0 comments 0 reactions 1 assignee Claimed by @edw-eqix View on GitHub
enhancement good first issue help wanted minor
Dominant language
Go
Stars
716
Forks
57
PR merge metrics
No merged PRs in 30d

Description

A frequent scripting trick is to forkbomb a bunch of things in parallel e.g. with xargs -P or plain old shell job control. When this happens, the child might want to do e.g. `otel-cli exec --tp-carrier "$otel_carrier" curl -H "traceparent: $TRACEPARENT" https://my/api/v1/thing` in the subprocesses. When this happens there is technically a race condition accessing the carrier file for read and write.

This probably isn't a big deal in practice because the file is so tiny, but we should do the right thing anyways.

https://github.com/gofrs/flock looks like a portable solution that probably won't blow up the dependency tree.

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.