Skip to content

fix(ingestor): a FIFO at the stats .tmp path blocks the stats writer forever #161

Description

@dborup

Summary

If a FIFO (named pipe) exists at <stats path>.tmp, the ingestor's stats writer blocks forever in os.OpenFile. Opening a FIFO for writing waits until a reader shows up. O_NOFOLLOW blocks symlinks but not FIFOs. The stats file then stops updating, and the writer goroutine never returns. This is pre-existing on master. It was found during the round-3 review of #141, outside that PR's delta.

Severity is low. Planting the FIFO needs write access to the directory that holds the stats file. In Docker that directory is private to the container.

Where

Not verified: the stop function waits on the writer goroutine (<-done), so shutdown probably hangs as well.

Proposed fix

  • Open with O_NONBLOCK added. On a FIFO without a reader this fails at once with ENXIO instead of blocking.
  • After opening, Fstat the file and refuse anything that is not a regular file, with a clear error.
  • Optionally, remove a non-regular .tmp with a log line, or just refuse and log (see the rate-limit follow-up for the owner error).

Acceptance criteria

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions