Does not reliably reload the configuration #12
Labels
No labels
bug
dependencies
documentation
duplicate
enhancement
github_actions
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
dd-ix/sflow_exporter#12
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Sometime it does, e.g.:
But others it does not and I have to restart the daemon. Maybe it does not notice the configuration file being replaced instead of being rewritten?
inotify is used to watch the config file:
github.com/dd-ix/sflow_exporter@4374f8ca79/src/main.rs (L86)Do you always replace the config file the same way (syscalls) when it does not work reliable?
Yes, the configuration generator basically uses:
And the
spew()documentation says the file is written to a temporary file and then renamed.When I notice it there is nothing else I can manually do to the file (append to it, move it, copy it...) to make the daemon reload it again.
The problem seemed to be, that the meta file was watched directly instead of the parent directly. According to some testing done by @liske this was wrong.
This should be fixed in v0.1.2.
Watching meta.yaml directly:

Watching parent folder:

Although
15c03e4691fixes the root cause of this issue it adds a minor regression by unnecessarily reloading the configuration whenever any file is written or moved to the configuration directory. IMHO the loop handling the inotify events needs to check if the configuration file was affected at all.Considering, we just load a yaml and load it into an internal data structure. I would argue that this is not enough compute that it would justify comparing the config to the previews version of the config.
I did not notice that the inotify event also contained the file name of the changed file when watching the parent directory. I've updated the code:
github.com/dd-ix/sflow_exporter@e297046ff1