Michael Andres changed bug 899755
What Removed Added
CC   dimstar@opensuse.org
Flags   needinfo?(dimstar@opensuse.org)

Comment # 4 on bug 899755 from
@Dominique:
I found some time to enhance libzypps global lock. A new libzypp-16.0.2 is
currently available here:

    obs://build.opensuse.org/zypp:Head
    obs://build.suse.de/Devel:zypp:SLE12SP2

Zypp no longer holds an internal reference to the lock file. So as soon as PK
drops it's last pointer to the ZYpp object, the lock file will vanish without
need to shutdown PK.

  ZYpp::Ptr zypp = ZYppFactory::instance().getZYpp();  // ZYpp object + lock
  ZYpp::Ptr zypp2 = ZYppFactory::instance().getZYpp(); // 2nd ref to ZYpp 

  zypp = nullptr;     
  zypp2 = nullptr;                                     // drops the lock

  zypp = ZYppFactory::instance().getZYpp();            // acquires the lock


With this, it's basically possible to let PK live longer than 15 seconds.


Note that the ZYpp object itself is currently not destroyed. If you reacquire 
the lock, the returned ZYPP object will be in the state as you left it.

The IMO next step is to test and enhance PK with libzypp-16.0.2. If PK lifetime
is prolonged, then it will be possible the system content got modified by
zypper while PK was sleeping. So you probably need to take care repos and
target are refreshed and reloaded in case they have changed. Otherwise PK will
operate on outdated data.


If this works, I'll need to enhance zypper, to suggest waiting until PK has
dropped it's lock rather than killing PK. Thet we can think about prolonging
the lifetime.


You are receiving this mail because: