[systemd-devel] UDEV popen/system returns error if called from the program (RUN option)
Ilya Matveychikov
matvejchikov at gmail.com
Tue Mar 3 12:45:53 UTC 2020
> On Mar 3, 2020, at 3:43 PM, Josef Moellers <jmoellers at suse.de> wrote:
>
> On 03.03.20 12:26, Ilya Matveychikov wrote:
>> Dear Lennart,
>>
>> Thank you for the reply.
>>
>>> On Mar 3, 2020, at 12:54 PM, Lennart Poettering <lennart at poettering.net> wrote:
>>>
>>> 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?
>>
>> I don’t do any multithreading in my program, except some popen()’s ..
>>
>> My system (archlinux) has "TasksMax=infinity” line in file:
>> /usr/lib/systemd/system/sysinit.target.wants/systemd-udev.service
>>
>> Any other tips?
> Just a shot in the dark: do you pclose() all popen()s?
I hope I do pclose() all of them. Anyway, the same behavior I’m getting
with trying to do system(“ls -al / >/xxx”) before any popen(), just in
the beginning of the program. It fails!
>
> Josef
> --
> SUSE Software Solutions Germany GmbH
> Maxfeldstr. 5
> 90409 Nürnberg
> Germany
>
> (HRB 36809, AG Nürnberg)
> Geschäftsführer: Felix Imendörffer
> _______________________________________________
> systemd-devel mailing list
> systemd-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/systemd-devel
More information about the systemd-devel
mailing list