worker: disconnect dbus from NameOwnerChanged signal (POO #183833)#6578
Conversation
|
I'm not 100% sure this is un-hacky enough to upstream, but figured I'd submit it at least. It'd be great if @berrange could comment. Relevant perl-net-dbus code areas:
|
|
The last time we ran into a very similar issue was https://progress.opensuse.org/issues/90872 , which we 'fixed' with os-autoinst/os-autoinst#1641 . |
48d115b to
ea30444
Compare
Yes it is a bit hacky, but at the same time I think it is likely the least worst option, given the constraints imposed by the perl-net-dbus implementation. Since the perl-net-dbus project is largely dormant, it is unlikely to see new changes that would invalidate the assumption made here. |
d38f66b to
32857f4
Compare
This avoids us piling up signals we never handle and eventually exceeding a dbus quota limit and causing all subsequent tap jobs to fail. New Net::DBus instances are automatically connected to this signal on creation, you cannot change this. If the instance is kept around but nothing iterates the dbus event loop once in a while, that signal will just keep piling up messages indefinitely. We encountered this once before in os-autoinst and "solved" it by not persisting the dbus connection, but in this case it doesn't seem a good idea to re-initialize that connection every time we want to check on the status of a tap worker. So instead let's disconnect it from the signal. The 1 here is a bit magical. The Net::DBus connect_to_signal method issues signal numbers on a first-come, first-served basis, starting at 1 (0 is never used), and returns the number it issued. When Net::DBus _new calls it, though, it doesn't record the return value. So we have to know/guess that this will always be the first signal connected. Related ticket: https://progress.opensuse.org/issues/183833 Signed-off-by: Adam Williamson <[email protected]>
32857f4 to
7c71f3f
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #6578 +/- ##
==========================================
- Coverage 99.11% 99.11% -0.01%
==========================================
Files 399 399
Lines 40707 40714 +7
==========================================
+ Hits 40347 40353 +6
- Misses 360 361 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This avoids us piling up signals we never handle and eventually exceeding a dbus quota limit and causing all subsequent tap jobs to fail.
New Net::DBus instances are automatically connected to this signal on creation, you cannot change this. If the instance is kept around but nothing iterates the dbus event loop once in a while, that signal will just keep piling up messages indefinitely. We encountered this once before in os-autoinst and "solved" it by not persisting the dbus connection, but in this case it doesn't seem a good idea to re-initialize that connection every time we want to check on the status of a tap worker. So instead let's disconnect it from the signal.
The 1 here is a bit magical. The Net::DBus connect_to_signal method issues signal numbers on a first-come, first-served basis, starting at 1 (0 is never used), and returns the number it issued. When Net::DBus _new calls it, though, it doesn't record the return value. So we have to know/guess that this will always be the first signal connected.
Related ticket: https://progress.opensuse.org/issues/183833