[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#922416: marked as done (cache.commit() doesn't release the archives lock)



Your message dated Mon, 11 Mar 2019 12:07:33 +0000
with message-id <E1h3JiP-0009ND-PW@fasolo.debian.org>
and subject line Bug#922416: fixed in python-apt 1.8.4
has caused the Debian Bug report #922416,
regarding cache.commit() doesn't release the archives lock
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
922416: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=922416
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: python-apt
Version: 1.8.3

Hi!

I have tools that use python-apt to interact with the system. Until recently I was using an old version of python-apt (1.4.0~beta3) and it was working fine.  I'm now migrating to the latest version (1.8.3) and I've encountered a problem with it.

When testing this version, I found a problem that seems to be related to the changes in locking.  The code that's failing is using the cache, calling cache.commit and after that's done, calling another command via subprocess that also interacts with apt.  The problem that I'm encountering is that this other command can't acquire the archives lock.

Following the code, I've realized that while the commit() function acquires a lock [1] (by calling get_lock on the Acquire object), it never actually releases this lock.

From my understanding of the C++ code, the lock is released when the object is garbage collected [2] and calling shutdown (which is what the commit() code does) is not enough.

The cache.update() function code is quite different in this regard.  It obtains and releases the code explicitly, instead of relying on the Acquire object [3]. I don't know if there's a reason behind these two different locking behaviors, but it seems to me that the commit one is wrong and it would be better to make it acquire and release the lock locally instead of relying on the Acquire object being garbage collected

[1] https://salsa.debian.org/apt-team/python-apt/blob/master/apt/cache.py#L623
[2] https://salsa.debian.org/apt-team/apt/blob/master/apt-pkg/acquire.cc#L192
[3] https://salsa.debian.org/apt-team/python-apt/blob/master/apt/cache.py#L555

I've found that opening and closing the file after calling commit() fixes the issue for me, so I'm pretty sure that there's a problem is that commit() leaving that file locked.

Please let me know if there's something I'm missing or that I'm somehow doing wrong.  Thanks!
--
Cheers,
Marga

--- End Message ---
--- Begin Message ---
Source: python-apt
Source-Version: 1.8.4

We believe that the bug you reported is fixed in the latest version of
python-apt, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 922416@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Julian Andres Klode <jak@debian.org> (supplier of updated python-apt package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@ftp-master.debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Format: 1.8
Date: Mon, 11 Mar 2019 12:49:18 +0100
Source: python-apt
Architecture: source
Version: 1.8.4
Distribution: unstable
Urgency: medium
Maintainer: APT Development Team <deity@lists.debian.org>
Changed-By: Julian Andres Klode <jak@debian.org>
Closes: 922416
Changes:
 python-apt (1.8.4) unstable; urgency=medium
 .
   * apt.Cache: Fix (un)locking in various places
     - Fix (un)locking of archives (Closes: #922416)
     - Use explicit, more safe locking in update()
   * Update mirror lists
Checksums-Sha1:
 9e1d2dbd0c0fbdf69ed9fc847d3c2ab5055b371d 2451 python-apt_1.8.4.dsc
 ad3c7a1fce0d91174bbfbd30e62938d71027b2d2 327784 python-apt_1.8.4.tar.xz
 fb69dfa74b89b894d767a7b8f9ec14723311b0b6 9901 python-apt_1.8.4_source.buildinfo
Checksums-Sha256:
 bd4b40c28280854beb4c1fb094afce2f6416a313a4c671f3fd897277ac84f6a0 2451 python-apt_1.8.4.dsc
 7831b3fd0093af5b76393f0d2610cb76c1d44e7aa438837779f9355a9174a220 327784 python-apt_1.8.4.tar.xz
 7d25b8fe896892e70888afc601f915e8a3bc71080204936e7a2afae36590c3b7 9901 python-apt_1.8.4_source.buildinfo
Files:
 ef5f988bcd7cf8532b57927d661317a4 2451 python optional python-apt_1.8.4.dsc
 29e93e2359981a55340330a85225ae4a 327784 python optional python-apt_1.8.4.tar.xz
 0edac14ae2455e817268eebe92c56414 9901 python optional python-apt_1.8.4_source.buildinfo

-----BEGIN PGP SIGNATURE-----

iQJDBAEBCgAtFiEET7WIqEwt3nmnTHeHb6RY3R2wP3EFAlyGS5sPHGpha0BkZWJp
YW4ub3JnAAoJEG+kWN0dsD9xAaUP/jcWJsNrMDXdNWcpnaFNJwK7APbUv9zoTNRU
pPft5A38SV2W0xl70TujKaVYog8MOjOkHKU7ULN6vZRRkNlyQl/TqHz6CWqPqteT
GDe2twxTkB1tX2YxBvL/wJh4mlvbq7kSryvA9Emfd9Mj+lwLqsfOG7z0NlrCSjC2
1i5k0/k11z6lWZWL4fbqPdVhC4iCq50d42dSs5RKqE1bTs2uq4uIh9IsEYTqpU3o
pGiQS/c9pV0aJJceUTBjTUYoNiv2+GO10Rcgty/9weoHLfvENX9x/XFoVEtlxFIG
H9feLIowz5MkRJ97J+g+pBpWpXaSPseShlzRs429QXpuNGjxN68e+HbHo2NbRYak
ZZ+8bvp2T1xKmlo2HswgwDgiC1hehXdeNy/3WGdLdLctky41LiEHdz3kk5vITbNL
K/ByTrJCBX0CVl9yGa8FljA6Hvm1x8NysdBrXrnOlRnw28HPzSnHo1v+WDBfCYZi
10tPY7wDjqTywwgNOUKAX4nKCwfSwF7VNPXT3/YAUvFl1UZG5tT8ho15mhI7WUCo
SrFg7iFUoVrvDAXvYkvU3kNDkBJcMtpBvELJb2BoDwz81Vxiczde45f5NGmbtV6f
1J7dR3oh9IQBqz8uTmARMN57RwXA8pFwu9DtIMS4nEHGkrzbJy4IX0ka/t85JVws
11k900yV
=PyVg
-----END PGP SIGNATURE-----

--- End Message ---

Reply to: