Open jjjordan opened 3 years ago
Thanks for the report @jjjordan
Just wanted to say thanks and let you know I've reproduced this and am working on it.
This is not limited to master, every release back to 0.21 at least has this issue. Couldn't test further back easily do to modules/vendor changes.
I'm beginning to think this is by design. That with quiescence enabled it has to spin every time the wait's timeout to check for updates as I don't think it has any means of telling if an update had occurred in the meantime or not.
Assuming I'm correct then this is a performance bug or optimization and not a behavioral issue. That is, it is doing the right thing just not very efficiently.
I'm going to sleep on this and look at it again tomorrow, and if I stick with my conclusion I'll leave fixing this until post hashicat refactor as it has it's own quiescence implementation that might not have this issue (I'd need to check) and if it does it has a lot more information about what has been updated so a more efficient fix might be an option there.
I looked over this today and I didn't see a simple way to optimize that so it wouldn't spin w/ >1 templates + quiescence. Summary w/ 2 templates both with waits (quiescence) set.
The "obvious" fix is to have it only run process the template whose wait timer expired. But this would require a pretty major refactor that would break the library usage of CT. Clearing other timers when one goes off doesn't work as the other timers could be on different cadences.
I'm going to re-classify this as a optimization/enhancement as the behavior is correct, it just wastes CPU.
I do think that the a fix will be doable along with the hashicat refactor.
@eikenb just stumbled onto this issue tracking down some some spurious logging in Nomad.
The downstream impact of this is (effectively) making the debug log level on Nomad useless. :(
Consul Template version
master branch
Configuration
I am running consul in development server mode from a docker container. KV data isn't important but we could start with this from
consul kv export
:Steps to reproduce
consul kv import
KV data provided above.consul-template -config config.hcl
with the config provided above.Debug output
https://gist.github.com/jjjordan/345102204e2dd85396cd554c07fa1ad8
Expected behavior
consul-template regenerates templates once in response to a single change.
Actual behavior
consul-template regenerates templates every second, in accordance with the min quiescence timer
References
None I'm aware of