Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 919164

Summary: sys-fs/lvm2-2.03.21-r1: dmeventd spawned by lvm hangs for minutes unless dm-event service is enabled
Product: Gentoo Linux Reporter: WGH <wgh>
Component: Current packagesAssignee: Gentoo's Team for Core System packages <base-system>
Status: RESOLVED UPSTREAM    
Severity: normal    
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
URL: https://gitlab.com/lvmteam/lvm2/-/issues/5
See Also: https://gitlab.com/lvmteam/lvm2/-/merge_requests/6
Whiteboard:
Package list:
Runtime testing required: ---

Description WGH 2023-12-04 17:36:54 UTC
LVM tools spawn dmeventd lazily when needed (i.e. when dmeventd isn't already running, or systemd-activated socket is not listening).

The problem is dmeventd is spawned in daemon mode, and its daemonization routine tries to close all file descriptors up to RLIMIT_NOFILE, which takes minutes when limit is billions (e.g. 1073741816).

Reproduction steps:

1) Not have dm-event.socket/dm-event.service enabled
2) Run some LVM command with large open file descriptor limit, e.g.: sudo sh -c 'ulimit -n 1073741816; lvcreate --size 15G --snapshot --name snap0 /dev/mapper/vg0-root'

Although the reproduction case above has an explicit ulimit -n 1073741816 command, processes run in systemd service context typically have large open file limit by default.

This is mostly an upstream issue, but it's partially caused by somewhat uncommon Gentoo policy of not enabling services when installing packages, and thus one is unlikely to encounter this problem on other distros.

Workaround: enable either dm-event.socket or dm-event.service. Those start dmeventd in foreground (-f), bypassing this daemonization step.
Comment 1 Mike Gilbert gentoo-dev 2023-12-05 19:52:42 UTC
There's really not much we can do about this. Our policy is to not enable services by default.

As well, dmeventd is optional, and may be disabled via lvm.conf.
Comment 2 WGH 2023-12-06 09:36:28 UTC
Fair enough. I opened the bug mainly to document the problem and its workarounds.

(and I personally do like the policy of not enabling services by default)
Comment 3 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-02-12 10:52:17 UTC
Thanks for proposing https://gitlab.com/lvmteam/lvm2/-/merge_requests/6 upstream. It's a nice fix.