Comment 105 for bug 107188

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

@Nikolaus Rath: What specs did your system have? How much mem/swap? This error is even earlier than most of the problems described in the report, it fails already when calling "uname -r".

I wonder if for the others:
=== modified file 'DistUpgrade/DistUpgradeController.py'
--- DistUpgrade/DistUpgradeController.py 2009-11-03 16:03:25 +0000
+++ DistUpgrade/DistUpgradeController.py 2009-11-13 13:01:00 +0000
@@ -1040,6 +1040,18 @@
                 logging.error("IOError in cache.commit(): '%s'. Retrying (currentTry: %s)" % (e,currentRetry))
                 currentRetry += 1
                 continue
+ except OSError, e:
+ logging.exception("cache.commit()")
+ # deal gracefully with:
+ # OSError: [Errno 12] Cannot allocate memory
+ if e.errno == 12:
+ self._enableAptCronJob()
+ msg = _("Error during commit")
+ msg += "\n'%s'\n" % str(e)
+ msg += _("Restoring original system state")
+ self._view.error(_("Could not install the upgrades"), msg)
+ # abort() exits cleanly
+ self.abort()
             # no exception, so all was fine, we are done
             self._enableAptCronJob()
             return True

would help mitigating the problem somewhat by at least restoring a clean system state if it happens.