All of lore.kernel.org
 help / color / mirror / Atom feed
* cgroup pids controller kills systemd service?
@ 2016-03-17 10:26 Han Pingtian
  0 siblings, 0 replies; only message in thread
From: Han Pingtian @ 2016-03-17 10:26 UTC (permalink / raw)
  To: linux-kernel

Hi,

I noticed that if a systemd service forks children fiercely, then the whole
service will be terminated, perhaps by the kernel. Is this designed?

I have this reproducer:

$ cat reproducer/reproducer.service
[Unit]
Description=Reproducer of bz 136929
After=multi-user.target

[Service]
ExecStart=/home/hpt/reproducer/reproducer.sh
Type=forking

[Install]
WantedBy=multi-user.target

% cat reproducer/reproducer.sh     
#!/bin/bash

foo()
{
        echo $1: $(date)
        sleep 30
}

bar()
{
        c=1
        while true
        do
                for ((i=1;i<=2048;i++))
                do
                        foo $c &
                        ((c++))
                done

                wait
                c=1
        done
}

# main
bar &

disown -a

exit 0

The default task limit of systemd is 512. Soon after the starting of the
service, it failed with those messages:

% sudo systemctl status reproducer.service                                                                                                                                                 4:02 hpt@pinelp3 ~ %
● reproducer.service - Reproducer of bz 136929
   Loaded: loaded (/etc/systemd/system/reproducer.service; disabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Thu 2016-03-17 04:02:09 CDT; 13s ago
  Process: 14859 ExecStart=/home/hpt/reproducer/reproducer.sh (code=exited, status=0/SUCCESS)
 Main PID: 14861 (code=exited, status=254)

Mar 17 04:02:07 pinelp3 reproducer.sh[14859]: /home/hpt/reproducer/reproducer.sh: fork: Resource temporarily unavailable
Mar 17 04:02:07 pinelp3 reproducer.sh[14859]: /home/hpt/reproducer/reproducer.sh: fork: Resource temporarily unavailable
Mar 17 04:02:07 pinelp3 reproducer.sh[14859]: /home/hpt/reproducer/reproducer.sh: fork: Resource temporarily unavailable
Mar 17 04:02:08 pinelp3 reproducer.sh[14859]: /home/hpt/reproducer/reproducer.sh: fork: Resource temporarily unavailable
Mar 17 04:02:08 pinelp3 reproducer.sh[14859]: /home/hpt/reproducer/reproducer.sh: fork: Resource temporarily unavailable
Mar 17 04:02:08 pinelp3 reproducer.sh[14859]: /home/hpt/reproducer/reproducer.sh: fork: Resource temporarily unavailable
Mar 17 04:02:08 pinelp3 systemd[1]: reproducer.service: Main process exited, code=exited, status=254/n/a
Mar 17 04:02:09 pinelp3 systemd[1]: reproducer.service: Unit entered failed state.
Mar 17 04:02:09 pinelp3 systemd[1]: reproducer.service: Failed with result 'exit-code'.
Mar 17 04:02:18 pinelp3 systemd[1]: Stopped Reproducer of bz 136929


Thanks in advance.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-03-17 10:27 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-17 10:26 cgroup pids controller kills systemd service? Han Pingtian

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.