Skip to content

Atomic file partial filename should be random (or use locking somehow) #11

Description

@joonas-fi

If two processes are racing to make the same final file:

rename /run/notifydedup/counter.json.part /run/notifydedup/counter.json: no such file or directory; also failed removing temp file: remove /run/notifydedup/counter.json.part: no such file or directory

Think timeline:

  • Process 1 starts producing counter.json.part
  • Process 2 starts producing counter.json.part, overriding first one
  • Process 1 renames the part file to target (thinking it is its own part file), effectively replacing the target file with an incomplete file

Is it possible to use locking with the part file in a way that two competing processes are not racing to produce the target file?

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

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions