touch-packages team mailing list archive
-
touch-packages team
-
Mailing list archive
-
Message #00974
[Bug 1271684] Re: File verification uses lots of memory
** Branch linked: lp:~barry/ubuntu-system-image/systemimage2.3
--
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to ubuntu-download-manager in
Ubuntu.
https://bugs.launchpad.net/bugs/1271684
Title:
File verification uses lots of memory
Status in Ubuntu Download Manager:
Fix Released
Status in Ubuntu system image (server/client/updater):
Fix Committed
Status in “ubuntu-download-manager” package in Ubuntu:
Fix Released
Bug description:
The file verification after downloading and checking the GPG signature
of a file needs a lot of memory.
The code looks like the whole file is read into memory to calculate
the sha256 hash, using more than 250MB of RAM in my case (while only
~100M are free on this ported device). This causes a lot of swapping
and a few minutes long freeze. In one out of three attempts, system-
settings closed during the freeze (oom kill?) and I had to restart the
verification.
In two places in state.py, hashlib is used like this :
# Verify the checksums.
for dst, checksum in checksums:
with open(dst, 'rb') as fp:
got = hashlib.sha256(fp.read()).hexdigest()
[...]
This could be changed to something like this (completely untested!):
# Verify the checksums.
chunk_size = 1024*1024
for dst, checksum in checksums:
hash = hashlib.sha256()
with open(dst, 'rb') as fp:
chunk = fp.read(chunk_size)
while chunk != '':
hash.update(chunk)
chunk = fp.read(chunk_size)
got = hash.hexdigest()
[...]
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu-download-manager/+bug/1271684/+subscriptions