[Bug 1795407] Re: python-apt frontend locking

Ɓukasz Zemczak 1795407 at bugs.launchpad.net
Mon Oct 1 18:42:44 UTC 2018


Hello Julian, or anyone else affected,

Accepted python-apt into xenial-proposed. The package will build now and
be available at https://launchpad.net/ubuntu/+source/python-
apt/1.1.0~beta1ubuntu0.16.04.3 in a few hours, and then in the -proposed
repository.

Please help us by testing this new package.  See
https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how
to enable and use -proposed.  Your feedback will aid us getting this
update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug,
mentioning the version of the package you tested and change the tag from
verification-needed-xenial to verification-done-xenial. If it does not
fix the bug for you, please add a comment stating that, and change the
tag to verification-failed-xenial. In either case, without details of
your testing we will not be able to proceed.

Further information regarding the verification process can be found at
https://wiki.ubuntu.com/QATeam/PerformingSRUVerification .  Thank you in
advance for helping!

N.B. The updated package will be released to -updates after the bug(s)
fixed by this package have been verified and the package has been in
-proposed for a minimum of 7 days.

** Changed in: python-apt (Ubuntu Xenial)
       Status: In Progress => Fix Committed

** Tags added: verification-needed-xenial

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to python-apt in Ubuntu.
https://bugs.launchpad.net/bugs/1795407

Title:
  python-apt frontend locking

Status in python-apt package in Ubuntu:
  Fix Released
Status in python-apt source package in Xenial:
  Fix Committed
Status in python-apt source package in Bionic:
  Fix Committed

Bug description:
  [Impact]
  Add support to python-apt for frontend locking. This is a bit more complicated, and also requires some other restructuring:

  (1) The archives lock was only taken for a short time, when it should
  have been kept for the duration of an installation, as otherwise debs
  could disappear from archives/ while the install is running.

  (2) There was no lock handling at all. Tools essentially acquire the
  lock, and then release it before commit().

  The fix is based on the apt fix, which makes apt_pkg.SystemLock()
  manage both the frontend and the normal lock, and allows code to call
  apt_pkg.pkgsystem_unlock_inner() and apt_pkg.pkgsystem_lock_inner()
  around dpkg invocations to release the inner lock.

  Cache.commit() takes care of locking itself now. It releases the inner
  lock as needed for dpkg invocations. It also now requires
  apt_pkg.SystemLock to be hold - if it is not, it will acquire it
  itself.

  [Test case]
  1. Mark a package in the cache for install/removal and commit() - FE lock should be taken while dpkg is running.
  2. Mark a package in the cache for install/removal and commit() while holding the lock. Releasing the lock afterwards should still work correctly, and the FE lock should never be released
  3. Observe that the archive lock is not released until the last dpkg run

  The locking behavior can be observed via strace.

  [Regression potential]
  The dpkg lock changed the most: Some lock counting might go wrong and programs might fail as a result. Any problems will be isolated, though - dpkg still acquires its locks, and if a lock miscount happens, apt would not tell dpkg to skip acquiring the frontend lock, so even if we were losing the lock anywhere, dpkg would still try to acquire it and not run unlocked.

  The archive lock done by commit()/fetch_archives() in apt.Cache() is
  now hold as long as the fetcher object exists though (as it uses the
  fetcher's get_lock method), which might cause unexpected behavior in
  apps not expecting that.

  The lists/ lock is unaffected by the changes, so there should not be
  any regressions when it comes to updating index files.

  [Other info]
  CI changes: There were some improvements to type hints for mypy needed to make type checks pass, and changes to the CI's Dockerfile to pull a new apt from the apt stable PPA (as a new enough apt is only in unapproved atm). Neither of those files are used anywhere outside of the package, so they should not cause any problems.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/python-apt/+bug/1795407/+subscriptions



More information about the foundations-bugs mailing list