Installing the chromium snap in test environment results in snapd being OOM-killed

For every update in the beta and candidate channels, some automated tests are run for the chromium snap on armhf and arm64 (RPi3). This used to work very well and would catch regressions. But lately tests on arm64 have started failing consistently. It appears that snapd is being killed while installing the chromium snap:

[  309.226714] Out of memory: Kill process 2063 (snap) score 10 or sacrifice child
[  309.237073] Killed process 2063 (snap) total-vm:1130284kB, anon-rss:10084kB, file-rss:0kB, shmem-rss:0kB
[  318.463195] Out of memory: Kill process 1280 (unattended-upgr) score 8 or sacrifice child
[  318.476861] Killed process 1280 (unattended-upgr) total-vm:105096kB, anon-rss:7956kB, file-rss:0kB, shmem-rss:0kB

On a RPi3b+ running bionic:

ubuntu@ubuntu:~$ sudo snap install chromium --channel=/candidate
Setup snap "chromium" (904) security profiles for auto-connections

And now we are seeing the kopano-webapp autopkgtests on focal/amd64 consistently failing with a similar error, when they install chromium-browser, which in turn installs the chromium snap:

Preparing to unpack .../00-chromium-browser_77.0.3865.120-0ubuntu2_amd64.deb ...
=> Installing the chromium snap
==> Checking connectivity with the snap store
==> Installing the chromium snap
2019-10-24T16:08:43Z INFO Waiting for restart...

Has there been a recent change (or set of changes) that might have increased the memory footprint of snapd when installing snaps? Or worse, a memory leak? Is the memory usage of snapd being monitored and data collected over time to spot regressions?

There isn’t a super-recent change that would cause this, but the problem was recently identified in with addressing the issue.

Thanks Jamie. I’ll be eagerly waiting for this fix to land, and will report back if it improves the situation with chromium.