[Bug 1130161] New: Unusual high memory usage while zypper is executing inside of lxc
http://bugzilla.opensuse.org/show_bug.cgi?id=1130161 Bug ID: 1130161 Summary: Unusual high memory usage while zypper is executing inside of lxc Classification: openSUSE Product: openSUSE Distribution Version: Leap 15.0 Hardware: Other OS: Other Status: NEW Severity: Normal Priority: P5 - None Component: libzypp Assignee: zypp-maintainers@forge.provo.novell.com Reporter: bugs+opensuse@lhpmail.us QA Contact: qa-bugs@suse.de Found By: --- Blocker: --- Created attachment 800904 --> http://bugzilla.opensuse.org/attachment.cgi?id=800904&action=edit strace output Host: Proxmox 5.3-11 I'm experiencing high memory usage with zypper that can exhaust resource limitations. This is before a zypper run: # free -m total used free shared buff/cache available Mem: 1024 26 943 8 53 997 Swap: 1536 0 1536 This is after a zypper run: # time zypper search openssh real 2m37.467s user 0m24.734s sys 2m10.524s Majority of the time is spent 'Reading installed packages...'. See attached strace output. # free -m total used free shared buff/cache available Mem: 1024 691 302 6 30 332 Swap: 1536 2 1533 # top top - 07:59:02 up 6 min, 1 user, load average: 0.77, 0.90, 0.51 Tasks: 20 total, 1 running, 19 sleeping, 0 stopped, 0 zombie %Cpu(s): 0.0 us, 0.0 sy, 0.0 ni,100.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st KiB Mem : 1048576 total, 308732 free, 708432 used, 31412 buff/cache KiB Swap: 1572864 total, 1570780 free, 2084 used. 340144 avail Mem PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 784 root 20 0 39248 3568 3060 R 0.333 0.340 0:00.02 top 1 root 20 0 74584 2196 388 S 0.000 0.209 0:00.52 systemd 42 root 20 0 67464 2264 1712 S 0.000 0.216 0:00.07 systemd-journal 49 root 20 0 101400 196 0 S 0.000 0.019 0:00.00 lvmetad 83 message+ 20 0 43548 1064 396 S 0.000 0.101 0:00.13 dbus-daemon 99 root 20 0 45652 1440 248 S 0.000 0.137 0:00.02 wickedd-dhcp6 100 root 20 0 45656 1524 332 S 0.000 0.145 0:00.02 wickedd-dhcp4 102 root 20 0 59364 856 292 S 0.000 0.082 0:00.04 systemd-logind 103 root 20 0 45652 1576 392 S 0.000 0.150 0:00.02 wickedd-auto4 136 root 20 0 45772 1732 388 S 0.000 0.165 0:00.03 wickedd 155 root 20 0 45680 1600 392 S 0.000 0.153 0:00.02 wickedd-nanny 619 root 20 0 6420 292 184 S 0.000 0.028 0:00.00 agetty 620 root 20 0 111152 1276 396 S 0.000 0.122 0:00.02 login 621 root 20 0 6420 292 184 S 0.000 0.028 0:00.00 agetty 622 root 20 0 6420 296 184 S 0.000 0.028 0:00.00 agetty 703 root 20 0 61272 928 340 S 0.000 0.089 0:00.02 master 704 postfix 20 0 63336 1440 828 S 0.000 0.137 0:00.00 pickup 705 postfix 20 0 63588 1680 844 S 0.000 0.160 0:00.00 qmgr 718 root 20 0 18536 968 392 S 0.000 0.092 0:00.00 cron 720 root 20 0 16016 4372 2032 S 0.000 0.417 0:00.07 bash Note, from the strace output, there are over 10 million calls to lstat: # grep lstat zypper.trace| wc -l 10988563 -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1130161
http://bugzilla.opensuse.org/show_bug.cgi?id=1130161#c1
Benjamin Zeller
http://bugzilla.opensuse.org/show_bug.cgi?id=1130161
http://bugzilla.opensuse.org/show_bug.cgi?id=1130161#c2
Lutchy Horace
http://bugzilla.opensuse.org/show_bug.cgi?id=1130161
http://bugzilla.opensuse.org/show_bug.cgi?id=1130161#c3
--- Comment #3 from Benjamin Zeller
http://bugzilla.opensuse.org/show_bug.cgi?id=1130161
http://bugzilla.opensuse.org/show_bug.cgi?id=1130161#c4
--- Comment #4 from Lutchy Horace
afaics most of the lstat calls are cgroup related. LXC makes heavy use of the cgroups, which is not something zypper can influence.
I'll make a report to Proxmox and LXC and see what they say.
In your strace there are 3237133 calls to lstat of which 3209403 are cgroups related alone.
Yeah, the original one was roughly 1.7GB vs ~440MB I just uploaded.
Do you still get the high memory consumption in the new container?
Yes, it max out 1G memory space while it's running and then hovers around 600-700MB that I can't account for. Caveat here though, memory usage somehow get's reduce overtime. The problem here however is that I can't barely do anything else while it's in this state. In fact, it's unusable in a 512MB CT which just locks up all processes in the container. AFAICS, 'zypper' seems to be the only program that exhibits this behaviour though I've only experimented with the CT for a very short time. -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1130161
http://bugzilla.opensuse.org/show_bug.cgi?id=1130161#c5
--- Comment #5 from Benjamin Zeller
http://bugzilla.opensuse.org/show_bug.cgi?id=1130161
http://bugzilla.opensuse.org/show_bug.cgi?id=1130161#c6
--- Comment #6 from Lutchy Horace
Must be a side effect of running inside your container. I cannot see a memory usage like that for a zypper search run on my machine directly.
I suspect that could be attributed to we're running entirely different LXC versions.
Can you provide the steps to reproduce your test env? Or is it just a plain OpenSUSE Tumbleweed container running in a default LXC container?
This bug report is against openSUSE Leap 15.0 though I am also experiencing similar behaviour with latest openSUSE Tumbleweed. Sure, you can see some context here https://forum.proxmox.com/threads/opensuse-containers-problem.52520/#post-24.... 1. Install latest Proxmox 5.3-11. 2. Pull latest image of openSUSE Leap 15.0 with lxc-download. 3. Create CT as unprivileged, see https://bugzilla.opensuse.org/show_bug.cgi?id=1130137. 4. Launch CT 5. At least for me, console doesn't get shown, lxc-attach will do. 6. Run 'zypper search openssh' 7. Observer memory usage from WebUI, lxc-info, or inside the container.
Also once zypper exits there is no way it can still use up any memory since the kernel will clean up all ressources that are allocated by the process.
I suspect this due to those lstat calls, something inside the kernel is holding that memory.
So if the mem consumption of your container stays high even after zypper exits there is something else wrong here.
I reported to LXC here https://github.com/lxc/lxc/issues/2918. I'll include another report to Proxmox later on. -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1130161
http://bugzilla.opensuse.org/show_bug.cgi?id=1130161#c7
--- Comment #7 from Lutchy Horace
http://bugzilla.opensuse.org/show_bug.cgi?id=1130161
http://bugzilla.opensuse.org/show_bug.cgi?id=1130161#c8
Michael Andres
$ grep lstat zypper.strace| grep '"/sys/' | wc -l 3237114 $ grep lstat zypper.strace| grep -v '"/sys/' | wc -l 19
@Benjamin: Could be target/modalias/Modalias.cc scanning /sys for 'modalias' files (for reolving the hardware deps). If it is, maybe we can somehow mitigate it. @ Lutchy Horace: Please try
touch /tmp/MODALIAS_SYSFS_FAKE ZYPP_MODALIAS_SYSFS=/tmp/MODALIAS_SYSFS_FAKE time zypper search openssh This will omit scanning /sys.
-- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1130161
http://bugzilla.opensuse.org/show_bug.cgi?id=1130161#c9
--- Comment #9 from Lutchy Horace
1.18user 0.16system 0:02.37elapsed 56%CPU (0avgtext+0avgdata 99868maxresident)k 0inputs+192outputs (0major+29391minor)pagefaults 0swaps
That's a lot better -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1130161
http://bugzilla.opensuse.org/show_bug.cgi?id=1130161#c10
Lutchy Horace
http://bugzilla.opensuse.org/show_bug.cgi?id=1130161
http://bugzilla.opensuse.org/show_bug.cgi?id=1130161#c11
--- Comment #11 from Michael Andres
find /sys/ -type f -name modalias -print0 | xargs -0 cat | sort -u >/tmp/modaliases ZYPP_MODALIAS_SYSFS=/tmp/modaliases
-- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1130161
http://bugzilla.opensuse.org/show_bug.cgi?id=1130161#c12
--- Comment #12 from Lutchy Horace
http://bugzilla.opensuse.org/show_bug.cgi?id=1130161
http://bugzilla.opensuse.org/show_bug.cgi?id=1130161#c13
--- Comment #13 from Benjamin Zeller
http://bugzilla.opensuse.org/show_bug.cgi?id=1130161
http://bugzilla.opensuse.org/show_bug.cgi?id=1130161#c14
--- Comment #14 from Lutchy Horace
Packages can specifiy those as a modalias entry in the package spec so the solver can select them if hardware with the same modalias is found in /sys.
I'm not disputing that, though in CT's, the Kernel package is _not_ installed. How useful are those drivers but extra bloat? I'm not sure how you guys plan to mitigate this but as for now, openSUSE under LXC on proxmox is just not really very usable. Cheers. -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1130161
http://bugzilla.opensuse.org/show_bug.cgi?id=1130161#c15
--- Comment #15 from Benjamin Zeller
I'm not disputing that, though in CT's, the Kernel package is _not_ installed. How useful are those drivers but extra bloat? I'm not sure how you guys plan to mitigate this but as for now, openSUSE under LXC on proxmox is just not really very usable.
Cheers.
I did not say we won't look into it, but figuring out a good workaround might take some time, first we need to figure out a simple example to reproduce. If your container does not use any packages that are hardware dependant you could export the variable Michael mentioned and use it as a workaround for the time being. Or you collect the sysfs once on boot into a file in /tmp and just use that for all zypper runs. I wonder if the command: "find /sys/ -type f -name modalias -print0 | xargs -0 cat | sort -u >/tmp/modaliases" produces a similar behaviour to a zypper run in your container. -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1130161
http://bugzilla.opensuse.org/show_bug.cgi?id=1130161#c16
Benjamin Zeller
/tmp/modaliases
And upload the output? Would be interesting to see what /sys files in your container are available. -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1130161
http://bugzilla.opensuse.org/show_bug.cgi?id=1130161#c17
--- Comment #17 from Michael Andres
http://bugzilla.opensuse.org/show_bug.cgi?id=1130161
http://bugzilla.opensuse.org/show_bug.cgi?id=1130161#c18
Lutchy Horace
http://bugzilla.opensuse.org/show_bug.cgi?id=1130161
http://bugzilla.opensuse.org/show_bug.cgi?id=1130161#c19
--- Comment #19 from Lutchy Horace
/tmp/modaliases find: ‘/sys/kernel/slab/:A-0000192/cgroup/cred_jar(1070883:getty@lxc-tty2.service)’: No such file or directory find: ‘/sys/kernel/slab/:A-0000192/cgroup/cred_jar(1070888:getty@lxc-tty5.service)’: No such file or directory find: ‘/sys/kernel/slab/:A-0000192/cgroup/cred_jar(1070893:getty@lxc-tty3.service)’: No such file or directory find: ‘/sys/kernel/slab/sock_inode_cache/cgroup/sock_inode_cache(1070903:getty@lxc-tty4.service)’: No such file or directory find: ‘/sys/kernel/slab/:A-0000064/cgroup/pid(1070831:pvesr.service)’: No such file or directory find: ‘/sys/kernel/slab/anon_vma/cgroup/anon_vma(1070908:getty@lxc-tty1.service)’: No such file or directory find: ‘/sys/kernel/slab/anon_vma/cgroup/anon_vma(1070913:getty@lxc-tty2.service)’: No such file or directory find: ‘/sys/kernel/slab/anon_vma/cgroup/anon_vma(1070918:getty@lxc-tty5.service)’: No such file or directory find: ‘/sys/kernel/slab/anon_vma/cgroup/anon_vma(1070923:getty@lxc-tty3.service)’: No such file or directory find: ‘/sys/kernel/slab/:A-0002112/cgroup/mm_struct(1070451:pvesr.service)’: No such file or directory find: ‘/sys/kernel/slab/:A-0002112/cgroup/mm_struct(1070928:getty@lxc-tty6.service)’: No such file or directory find: ‘/sys/kernel/slab/:0000256/cgroup/kmalloc-256(1070938:getty@lxc-tty1.service)’: No such file or directory find: ‘/sys/kernel/slab/:0000256/cgroup/kmalloc-256(1070943:getty@lxc-tty2.service)’: No such file or directory find: ‘/sys/kernel/slab/:A-0000256/cgroup/filp(1070953:getty@lxc-tty3.service)’: No such file or directory find: ‘/sys/kernel/slab/:A-0000208/cgroup/vm_area_struct(1070958:getty@lxc-tty6.service)’: No such file or directory find: ‘/sys/kernel/slab/:A-0000208/cgroup/vm_area_struct(1070963:getty@lxc-tty4.service)’: No such file or directory find: ‘/sys/kernel/slab/:aA-0000192/cgroup/dentry(1070973:getty@lxc-tty2.service)’: No such file or directory find: ‘/sys/kernel/debug’: Permission denied
real 0m35.227s user 0m18.996s sys 0m15.842s The memory balloon marginally and stayed high for a bit. I'm guessing garbage collection hasn't kicked in yet at Kernel level. Though the differences is not as drastic as Zypper. -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1130161
http://bugzilla.opensuse.org/show_bug.cgi?id=1130161#c20
--- Comment #20 from Lutchy Horace
participants (1)
-
bugzilla_noreply@novell.com