Bug 69575

Summary: systemd emits UnitNew in response to Properties.Get, potentially leading to loops.
Product: systemd Reporter: Marius Vollmer <marius.vollmer>
Component: generalAssignee: systemd-bugs
Status: NEW --- QA Contact: systemd-bugs
Severity: normal    
Priority: high    
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description Marius Vollmer 2013-09-19 13:01:39 UTC
Systemd 207, with patches.

I have a program that reacts to UnitNew signals from systemd by issuing a Properties.GetAll call to the new unit.

Now, if someone anywhere issues a Properties.GetAll call (or probably any other call) for a non-loaded unit, systemd will emit two UnitNew/UnitRemoved signals back to back.

By the time my program has received the UnitNew signal of the pair and issued the Properties.GetAll call, the unit has already disapeared again from systemds memory, and the Properties.GetAll call results in another pair of UnitNew/UnitRemove signals.

This will then cause my program to call Properties.GetAll again, leading to a tight infinite loop.

This didn't happen with systemd 201.

I think it is reasonable to react to a UnitNew signal with a Properties.GetAll call.  No?
Comment 1 Marius Vollmer 2015-08-21 07:57:17 UTC
Fwiw, I am still seeing this behavior with systemd 219.  As a workaround, I am now listening to the Reloading, JobNew, and JobRemoved signals instead of UnitNew.  This seems to catch all points where unit properties might change without a PropertiesChanged signal.
Comment 2 stugol 2015-12-30 04:54:29 UTC
This is a massive problem for me as well. When will this glaring flaw be fixed?

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.