Repository navigation
timedate, locale: fix barrier to suppress multiple function calls - #9684
Conversation
|
Thanks @yutawa! With this PR applied, I did not get the "NTP flag is eternally wrong" bug any more. It is stil |
|
Update: While this PR might be a valid fix, it is not fixing the root cause of #9672, which is the wrong |
|
@martinpitt Thank you for checking this PR. I've force-pushed an updated version. Now, timedated wait after stopping/starting NTP client service. PTAL. |
There was a problem hiding this comment.
Hmm, this changes the semantics of method_set_ntp significantly — before it'd be "set the state" and now it is "set the state, wait for the unit to be started or stopped". Additional wrinkle is that if a second parallel method_set_ntp is made in parallel, the first one will cut the wait short, so the condition is really more like "wait for the unit to be started or stopped OR for another method_set_ntp call to come in". Shouldn't the change be made smaller, to keep the call asynchronous, and only wait on the job to be finished to send out the property change? This should fix the original issue, without changing the semantics of the call. I'm not sure what the proper solution is, so I'm putting this out here for discussion.
There was a problem hiding this comment.
I confirm that this fixes the wrong property changed value. However, I agree with @keszybz that it seems cleaner to not make SetNTP blocking, and just defer the PropertyChanged signal until the NTP unit is actually running.
There was a problem hiding this comment.
Ah, I see. OK, I will update this. Thank you.
|
@martinpitt and @keszybz Updated. Changes are
PTAL. Thank you. |
|
@yuwata: Thanks! The property changes look correct now. The commit message should be adjusted to what it's actually doing (deferring the Property Changed signal, the method itself does not wait), otherwise this LGTM now. |
|
@martinpitt Thank you for testing this. I've updated commit message. |
No, please don't do that. As you write in the commit message, this method can be called frequently. Now that would become an error and require special handling. Instead this should behave the similarly to repeated |
Oh, that explains a strange new cockpit test case failure that I've seen with this PR applied. Indeed! |
|
@keszybz and @martinpitt Thank you for the comment. I've force-pushed a revised version. Changes from the previous revision are the following:
|
keszybz
left a comment
There was a problem hiding this comment.
Thank you for your patience ;) Some more questions from my side...
There was a problem hiding this comment.
So... is this check really necessary? Wouldn't it be simpler and more reliable to just send the job start/stop request always? Imagine the following scenario:
- the service is not running
- somebody calls enable through
timedated,timedatedqueues a start job - the start job finishes
- a stop job is queued through
systemctl stop - somebody calls enable through
timedated,timedatedqueues a start job
Even if 4 and 5 are always in that order, depending on whether 3 is earlier or later, the outcome will be different (in one case a new start job will be queued, in the other not).
My thinking is that pid1 is the only place that really know the current state, and the only cost we have from forwarding all the enable/disable calls to it is a dbus call, which is not expensive.
There was a problem hiding this comment.
That is a very good question. While I update this, I noticed that. So, can I confirm your suggestion? You mean that we should set in some sense that ignore_active_state always true?
I will test the racy conditions later and may update this. Thank you so much for giving comments so many times.
The commit 5d28074 introduces a barrier to suppress calling context_update_ntp_status() multiple times. However, it just stores the address of sd_bus_message object. So, when an address is reused on the subsequent message, then the status of NTP clients are not updated. This makes the stored message object is referenced by the context object. So, the subsequent message is on cirtainly different address.
…pping NTP service is finished Before this, the property changed signal is emitted immediately after StartUnit/StopUnit method is called. So, the running state of the NTP client service may not updated. This makes the timing of emitting property changed signal is deferred until job of starting/stopping NTP client service is completed. Fixes systemd#9672.
|
@keszybz Updated. It seems work now with the combination of
|
|
@yuwata thanks. |
Fixes #9672.