Possible Infinite Loop in "commit()" Method
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
python-apt (Ubuntu) |
Invalid
|
High
|
Michael Vogt |
Bug Description
Binary package hint: python-apt
This bug is related to:
https:/
In researching possible causes of the memory leak exceptions reported by some users attempting to upgrade using the "upgrade-manager" tool, a possible infinite loop resulting in memory leakage was identified in the "commit()" method of the "Cache" class in "apt/cache.py".
The method in question fetched and installed the required archives within a while loop, breaking from this loop only in the event of installArchives "ResultCompleted" or "ResultFailed". The intended function of this loop was assumed to be to attempt repeating the installation if installArchives returned a value of "ResultIncomplete". However, in some cases "ResultIncomplete" is returned due to an unmet condition of the installation, resulting in an infinite loop. A possible source of unmet conditions is a failure in fetching the archives to be installed; a situation not tested for within the loop.
I am also submitting an experimental patch I used to resolve this issue on my machine. In the patch a check is added on the return value of _fetchArchives() before calling installArchives(), in an effort to stop the installation going forward without all pre-conditions being met. The fetching and installing of archives is removed from the loop, and a return value of "ResultIncomplete" causes a new type of system error to be raised. This was done because I believe it would be better to have the calling program make the decision to re-attempt installation rather than doing so automatically. The final change is just a response to the FIXME in the "markUpgrade()" function of "apt/package.py". As described in the above update-manager bug report, the failure of markUpgrade() to raise an exception caused unexpected behavior in the update-manager code.
The patch was written for the python-
Thanks for your bugreport and your patch.
Are you able to reproduce the crash that is reported in #107188 in one of your test machines? If so, I would love to debug it further with you, I was never able to reproduce it myself. The python-apt code in question is used by gdebi and update-manager in gtk too and I have never seen a issue like the one in #107188 here. If the python-apt code is the problem, then it must be something within the KDE upgrade view that triggers the problem. You can reach me on irc as "mvo" on irc.freenode.net and as <email address hidden> on jabber.