public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Han Pingtian <hanpt@linux.vnet.ibm.com>
To: linux-kernel@vger.kernel.org
Subject: cgroup pids controller kills systemd service?
Date: Thu, 17 Mar 2016 18:26:16 +0800	[thread overview]
Message-ID: <20160317102616.GA2986@localhost.localdomain> (raw)

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.

                 reply	other threads:[~2016-03-17 10:27 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160317102616.GA2986@localhost.localdomain \
    --to=hanpt@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox