Comment 60 for bug 107188

Revision history for this message
Scott Kitterman (kitterman) wrote : Re: [MASTER] [kde] Upgrade tool crashed with " Cannot allocate memory" (edgy -> feisty)

I think this is a fundamental design problem that is going to take some serious rework if this is going to work on low memory systems. I hunted down were the memory is getting eaten up. It's in DistUpgradeControler.py. I added comments to the procedure below to show the fatal line. The bottom line is that the system is just trying to cache more than a machine with limited memory can hande. Someone who knows more about the what and the why of the cache will have to look and see if it can be slimmed down.

    def doDistUpgrade(self):
        # get the upgrade
        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:
            try:
                # THIS IS THE FATAL LINE:
                res = self.cache.commit(fprogress,iprogress)
                # THE ONE ABOVE THIS ONE.
            except SystemError, e:
                logging.error("SystemError from cache.commit(): %s" % e)
                # check if the installprogress catched a pkgfailure, if not, generate a fallback here
                if iprogress.pkg_failures == 0:
                    errormsg = "SystemError in cache.commit(): %s" % e
                    apport_pkgfailure("update-manager", errormsg)
                # invoke the frontend now
                msg = _("The upgrade aborts now. Your system "
                        "could be in an unusable state. A recovery "
                        "will run now (dpkg --configure -a).")
                if not run_apport():
                    msg += _("\n\nPlease report this bug against the 'update-manager' "
                             "package and include the files in /var/log/dist-upgrade/ "
                             "in the bugreport.\n"
                             "%s" % e)
                self._view.error(_("Could not install the upgrades"), msg)
                # installing the packages failed, can't be retried
                self._view.getTerminal().call(["dpkg","--configure","-a"])
                self._rewriteAptPeriodic(self.apt_minAge)
                return False
            except IOError, e:
                # fetch failed, will be retried
                logging.error("IOError in cache.commit(): '%s'. Retrying (currentTry: %s)" % (e,currentRetry))
                currentRetry += 1
                continue
            # no exception, so all was fine, we are done
            self._rewriteAptPeriodic(self.apt_minAge)
            return True