New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
hostnamed: stop caching so much #15624
Conversation
58527ba
to
25d7777
Compare
25d7777
to
d84df66
Compare
force pushed with the suggested changes. no other changes. (i added a pretty long and nice comment to that property handling code, i hope this is very clear now...) |
(eventually we should add the same logic to localed and timedated, btw) |
d84df66
to
f3c6093
Compare
Looks related ;( |
... it is quite possible that the error is in the test, but it needs to be reconciled anyway. |
Split the first four commits into #15804. Hopefully they pas and we can merge them before the others. |
four likely safe commits split out of #15624
more hostnamed fixes, split out of #15624
f3c6093
to
a5e453c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pul requested
a5e453c
to
acce1b6
Compare
Querying the current hostname is cheap, hence let's not cache it. That way it is much less likely we'll return out-of-date data.
…c/machine-info Instead of reading these files at startup and never again, let's read them when we need them. As an optimization (in particular as some of these files contain the data for many fields at once) let's cache the results as long as the stat data (i.e. mtime) remains stable. Also, while we are at it, if we can't read any of these props, let's not fail everything, but continue without the data.
acce1b6
to
d7f4ad2
Compare
So seams I finally tracked this one down. The fix was trivial ultimately: not only when clients query the hostname and other data from hostnamed we need to possibly refresh the data from what#s on disk, but also when we make changes to it, since we actually take the status quo into consideration too when figuring out how the updated data is to be propagated to the kernel's setting, and similar. So I added a few calls to re-read data on disk in the setters in addition to the getters and everything worked. @keszybz already liked this once, given the trivial fix I figure it should be OK to set the green label again? |
LGTM. |
bionic-amd64 is still outstanding, but it's been slow lately, and I don't think this is in any way arch-specific, so let's not wait for it. |
Let's always report current settings instead of what we read while initializing. It's less confusing to users, as it makes hostnamed a much thinner layer around the backing logic.
Prompted by this thread:
https://lists.freedesktop.org/archives/systemd-devel/2020-April/044395.html