Comment 94 for bug 107188

Revision history for this message
BigPick (wpickard) wrote : Re: [patch] Upgrade tool crashed with " Cannot allocate memory"

OMG its Michael! Thank goodness your here!

Forgive my moronic meddling, I obviously have absolutely no clue what I am doing. I went over my patch again and realized that my changes to the commit retry loops:

- currentRetry = 0
         fprogress = self._view.getFetchProgress()
         iprogress = self._view.getInstallProgress(self.cache)
         # retry the fetching in case of errors
         maxRetries = self.config.getint("Network","MaxRetries")
- while currentRetry < maxRetries:
+ for currentRetry in range(maxRetries):

...
             except IOError, e:
                 # fetch failed, will be retried
                 logging.error("IOError in cache.commit(): '%s'. Retrying (currentTry: %s)" % (e,currentRetry))
- currentRetry += 1

do absolutely nothing. :-D I somehow convinced myself that if an error other than a IOError were thrown, it would be magically caught by the try/catch statement and ignored, resulting in an infinite loop. This is obviously not the case, as erroneous exceptions are immediately passed up to DistUpgradeViewKDE and handled by _handleException. So that wasn't doing anything. No infinite loop. That leaves:

- self[key].markUpgrade()
+ self[key].markInstall()

as the only line which could have made any difference. (And it did for me and a few others for some reason.) What's interesting is that method call is only made in the section of the commit function that checks the state of the main metapackages (kubuntu-desktop, ubuntu-desktop, edubuntu-desktop, etc.). After looking back through my own logs and the logs that others have posted, I noticed that one commonality between some of them was kubuntu-desktop indicated that is wan't installed. In my case, kubuntu-desktop was accidentally removed accidentally by adept a while back when I replaced the ubuntu OO.o packages with ones from a third party repository to fix a font display issue. But this doesn't totally explain everything because the code that reports kubuntu-desktop as not being installed:

 if not metaPkgInstalled():
            logging.debug("none of the '%s' meta-pkgs installed" % metapkgs)
            for key in metapkgs:
                deps_found = True
                for pkg in self.config.getlist(key,"KeyDependencies"):
                    deps_found &= self.has_key(pkg) and self[pkg].isInstalled
                if deps_found:
                    logging.debug("guessing '%s' as missing meta-pkg" % key)
                    try:
                        self[key].markInstall()

occurs after the line that the patch changes. What I do know is that the difference between my failure logs and my success logs is the kubuntu-desktop metapackage being reported as installed in my successful logs right where the error occurs in my failure logs.

So far my only way to reliably test this has been to load Feisty installs onto my two sandbox towers and run them through the update process until they throw the error. Its a crude method of testing though and takes forever. I'm going to reload Feisty again on one of my tower, as both got to Gutsy despite my inept patch attempt, and give your patch a try. It makes sense to explicitly declare AutoDestroy as it is the KDEInstallProgressAdapter forks that seem to be causing the trouble, but I was under the impression that AutoDestroy was enabled by default.

What would you recommend as the best way to get usable debugging output? pdb, strace, or even gdb? I don't usually code in python so I'm not familiar with the debugging methods.

Many Thanks,
BigPick