Skip to content

reloader: config file stops being watched in case of atomic updates #8127

Open
@machine424

Description

@machine424

Thanos, Prometheus and Golang version used:
reloader used by prometheus-operator

Object Storage Provider:

What happened:

When the CfgFile is updated atomically which results in the file being deleted and recreated (through temp file and rename or other) the watcher will stop receiving events for the as the original file was deleted.

fsnotify warns about that here https://github.com/fsnotify/fsnotify/blob/a9bc2e01792f868516acf80817f7d7d7b3315409/README.md?plain=1#L128

As a workaround the parent dir of can be added to WatchedDirs (assuming it doesn't contain noisy files)

Related prometheus-operator PR prometheus-operator/prometheus-operator#7366

What you expected to happen:

watcher should handle atomic updates of CfgFile

How to reproduce it (as minimally and precisely as possible):

run a reloader for a CfgFile, delete CfgFile, recreate CfgFile, change its content, reload will not be triggered immediately, but at the next WatchInterval tick.

Full logs to relevant components:

Anything else we need to know:

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions