snappy update takes very long (infinite loop?)
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Snappy |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
I was looking at bug 1411112 this morning and tried to reproduce it. This involves installing image 211, and updating it to the latest one:
sudo ubuntu-device-flash --revision 211 --verbose core --output=
kvm -m 2048 -snapshot -drive file=/tmp/
ssh -o UserKnownHostsF
Then in snappy, do "sudo snappy update". This downloads the 151 image, and then is spinning "Applying [/]". I've waited for 30 minutes, and it's still not done. My /tmp is a tmpfs, so there should be pretty much zero I/O wait, fsync delays or otherwise.
I see three processes
root 937 0.1 0.6 56868 14124 ? S 13:51 0:00 /usr/bin/python3 /usr/bin/
root 938 0.0 0.5 56868 11168 ? S 13:51 0:00 /usr/bin/python3 /usr/bin/
root 939 95.5 1.8 148088 37428 ? R 13:51 0:45 /usr/bin/python3 /usr/bin/
937 just waits on 938, 938 just waits on 939, so these are harmless. 939 is taking 100% CPU all the time (for the full half an hour until I aborted it).
affects: | snappy-ubuntu → snappy |
stracing process 939 shows a ton of read()s like
read(6, "\365\261, \303$\177\ 311P\223i\ 263\23\ 214@=Q\ 304\343\ 315\22Y{ -\344C8\ 217\357Q\ 271\327' "..., 8192) = 8192
fd 6 is (/proc/939/fd/6)
lr-x------ 1 root root 64 Jan 23 13:55 6 -> /writable/ cache/ubuntu- 167a812c3c894b5 37fa348f36452d2 88e03bb0670fd35 8234e261bd41aaa 00b3.tar. xz
which is
-rw-r--r-- 1 root root 65179348 Jan 23 13:51 /writable/ cache/ubuntu- 167a812c3c894b5 37fa348f36452d2 88e03bb0670fd35 8234e261bd41aaa 00b3.tar. xz
But it's not only read() calls, after some time I also see stats, chowns etc. of different files in the file system.
I wonder if it's just doing something exceptionally expensive here? Like trying to extract the files from the tarball in non-linear order, so that for each file it has to decompress the whole tarball, seek, and extract a file? But then again I don't see any seeks or close/reopen of fd 6. At this point it's probably better to look at what the upgrader does from a higher level than strace.