[zypp-devel] Using python zypp in a daemon without locking zypper forever
Hi, I'm trying to integrate libzypp to a daemon which is written in python. I'm using SLES12 with the following components: zypper- 1.12.45 -31.2.x86_64 libzypp- 15.23.1-30.1 .x86_64 python-zypp-0.7.3-1.6.x86_64 It's working pretty good but unfortunately, it does block zypper from being used as the daemon will keep the "lock" even if the zypp object is destroyed. I have attached 3 examples which illustrates the issue: - testZ.py will just initate the zypp library and then sleep forever in a while loop. - testThread.py will do the same but will initate the zypp library in a separate thread - testProcess.py will use a new process instead of a thread Just start the test application and then try to use zypper in a second shell e.g. zypper search which will then show the following message: System management is locked by the application with pid 18852 (python). Close this application before trying again. The same happpens for testThread.py. testProcess.py does work as the process in which zypp was initiated will be terminated and everything is free'd. Does someone know how to get the testZ.py example running? I don't want to start a process (or thread) for doing the zypp stuff within the daemon. Would be great if there is a better solution. Thank you in advance. Best regards, Bernhard Suttner ______________________________________________________ ATIX - The Linux & Open Source Company
On Wednesday 15 March 2017 13:26:52 Bernhard Suttner wrote:
zypper- 1.12.45 -31.2.x86_64 libzypp- 15.23.1-30.1 .x86_64
I needs at least libzypp-16.1.1. (Leap-42.2 / SLE-12-SP2) Older libzypp versions are not able to drop the lock at runtime. (and they also don't have 'zypp.ZYppFactory_instance().haveZYpp()' to test whether the instance is present.) On older distros you need to run zypp in a separate process, so libzypp gets unloaded and releases the lock. -- cu, Michael Andres +------------------------------------------------------------------+ Key fingerprint = 2DFA 5D73 18B1 E7EF A862 27AC 3FB8 9E3A 27C6 B0E4 +------------------------------------------------------------------+ Michael Andres SUSE LINUX GmbH, Development, ma@suse.com Maxfeldstrasse 5, D-90409 Nuernberg, Germany, ++49 (0)911 - 74 053-0 +------------------------------------------------------------------+ SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) +------------------------------------------------------------------+ -- To unsubscribe, e-mail: zypp-devel+unsubscribe@opensuse.org To contact the owner, e-mail: zypp-devel+owner@opensuse.org
Bernhard Suttner writes:
Hi,
I'm trying to integrate libzypp to a daemon which is written in python. I'm using SLES12 with the following component
Out of curiosity, can you share what the daemon does or what are you trying to make libzypp do from your daemon? -- Duncan Mac-Vicar P. - Director, Data Center Management; R&D SUSE Linux GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany GF: Felix Imendörffer, Jane Smithard, Dilip Upmanyu, Graham Norton, HRB 21284 (AG Nürnberg) -- To unsubscribe, e-mail: zypp-devel+unsubscribe@opensuse.org To contact the owner, e-mail: zypp-devel+owner@opensuse.org
I'm nearly ready with the implementation step 1 and need to test it a little bit more. Afterwards I will publish the change on github and will write a message to the list so that you can have a look on it. :-) ----- Ursprüngliche Mail ----- Von: "Duncan Mac-Vicar P." <dmacvicar@suse.de> An: "Bernhard Suttner" <suttner@atix.de> CC: zypp-devel@opensuse.org Gesendet: Mittwoch, 15. März 2017 15:27:07 Betreff: Re: [zypp-devel] Using python zypp in a daemon without locking zypper forever Bernhard Suttner writes:
Hi,
I'm trying to integrate libzypp to a daemon which is written in python. I'm using SLES12 with the following component
Out of curiosity, can you share what the daemon does or what are you trying to make libzypp do from your daemon? -- Duncan Mac-Vicar P. - Director, Data Center Management; R&D SUSE Linux GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany GF: Felix Imendörffer, Jane Smithard, Dilip Upmanyu, Graham Norton, HRB 21284 (AG Nürnberg) -- To unsubscribe, e-mail: zypp-devel+unsubscribe@opensuse.org To contact the owner, e-mail: zypp-devel+owner@opensuse.org -- To unsubscribe, e-mail: zypp-devel+unsubscribe@opensuse.org To contact the owner, e-mail: zypp-devel+owner@opensuse.org
participants (3)
-
Bernhard Suttner
-
Duncan Mac-Vicar P.
-
Michael Andres