>>> Brian Reichert <reich...@numachi.com> schrieb am 19.09.2022 um 19:18 in
Nachricht <20220919171812.gf74...@numachi.com>:
> I apologize for the vague subject.
> The background: I've inherited some legacy software to manage.
> This is on SLES12 SP5, running:
>       systemd‑228‑157.40.1.x86_64
> One element is a systemd‑managed service, written in Perl, that in
> turn, is using bash to generate random numbers (don't ask me why
> this tactic was adopted).
> Here's an isolation of that logic:
>   pheonix:~ # cat /root/random_str.pl
>   #!/usr/bin/perl
>   print "$0 start ".time."\n";
>   my $randStr = `cat /dev/urandom|tr ‑dc "a‑zA‑Z0‑9"|fold ‑w 64|head ‑1`;
>   print "$0 end ".time."\n";
> You can run this from the command‑line, to see how quickly it
> nominally operates.
> What I can reproduce in my environment, very reliably, is that when
> this is invoked as a service:
> ‑ the 'head' command exits very quickly (to be expected)
> ‑ the shell does not exit (maybe missed a SIGCHILD?)
> ‑ 'fold' chews a CPU core
> ‑ A kernel trace shows that 'fold' is spinning on SIGPIPEs, as it's
>   STDOUT is no longer connected to another process.

When I run the command "cat /dev/urandom|tr -dc "a-zA-Z0-9"|fold -w 64|head
-1" outside systemd and Perl in SLES15 SP5 there is no problem, so I guess none
of the tools used is broken.


Reply via email to