[systemd-devel] UDEV popen/system returns error if called from the program (RUN option)

Lennart Poettering lennart at poettering.net
Tue Mar 3 09:54:37 UTC 2020


On Mo, 02.03.20 00:35, Ilya Matveychikov (matvejchikov at gmail.com) wrote:

> Hey guys,
>
> I’m not sure is it the right place to ask about the UDEV or not.
>
> Anyways, I have a problem with running custom program from the UDEV rule (RUN+= option).
> The problem is somehow related to fork/exec, I can’t tell for sure.
>
> My code (this custom “RUN+=“-binary) using popen() to call external program
> and get the result using stream. Once I run this custom program alone it works
> perfectly well. But once it is executed under the systemd/udev via the rule
> this popen() returns error with the code ENOMEM which is very strange for me
> as the system has like 32Gb of RAM.
>
> The same happen with system() ...
>
> Do you guys have any glue of what the heck is going on?
> Are there any constraints on what can be done in “programs”?

We enforce a limit on the number of processes/threads forked off
services, and udevd has a limt set like that too, via the TasksMax=
setting in its unit file. Maybe you are leaking processes/threads
somehow and hit that limit?

Lennart

--
Lennart Poettering, Berlin


More information about the systemd-devel mailing list