Commit graph

4376 commits

Author SHA1 Message Date
Yu Watanabe 14cb109d45 tree-wide: replace 'unsigned int' with 'unsigned' 2018-10-19 22:19:12 +02:00
Lennart Poettering 490c5a37cb tree-wide: some automatic coccinelle fixes (#10463)
Nothing fancy, just coccinelle doing its work.
2018-10-20 00:07:46 +09:00
Evgeny Vereshchagin 2ac1ff68f2 core: stop ignoring errors in connect_logger_as
When journald reaches the maximum number of active streams, it,
basically, starts to decline new connections. On the client
side it can be detected by getting EPIPE and, if the writing
process isn't lucky enough, getting SIGPIPE soon afterwards.
systemd has always ignored EPIPE, which makes it very hard
to keep track of services losing logs. This patch should make
it easier to detect such services by just staring at the logs
carefully.

In case anyone is interested, the following one-liner run as any user
can be used to paralyze all the stream logging on a machine:

for i in {1..4096}; do systemd-cat -t HEY-$i & done
2018-10-19 10:32:21 +02:00
Lennart Poettering 6ab1853953
Merge pull request #10460 from yuwata/setsockopt_int-more
tree-wide: use setsockopt_int() more
2018-10-19 10:12:00 +02:00
Lennart Poettering a87b1faad3 core: beautify per-unit consumed resources log message a bit. (#10390)
Shorten message to say "no IP traffic" if there is no IP traffic, rather
than "received 0B IP traffic, sent 0B IP traffic".

Fixes: #9816
2018-10-19 09:04:12 +09:00
Yu Watanabe 17acb7ef9a
Merge pull request #10450 from poettering/foreach-line-excorcism
FOREACH_LINE excorcism
2018-10-19 08:44:51 +09:00
Yu Watanabe 9e5b649655 tree-wide: use setsockopt_int() more 2018-10-19 05:52:42 +09:00
Lennart Poettering 986c8af1b8
Merge pull request #10456 from poettering/setsockopt-int
add a setsockopt_int() helper and make use of it everywhere
2018-10-18 21:53:01 +02:00
Lennart Poettering 6d4150cb45 job: add a comment that JOB_DONE also means skipped due to condition (#10453) 2018-10-19 03:55:30 +09:00
Lennart Poettering 2ff48e981e tree-wide: introduce setsockopt_int() helper and make use of it everywhere
As suggested by @heftig:

6d5e65f645 (commitcomment-30938667)
2018-10-18 19:50:29 +02:00
Lennart Poettering 849d653a4e
Merge pull request #10239 from yuwata/sd-device-monitor
sd-device: introduce sd_device_monitor
2018-10-18 18:30:38 +02:00
Lennart Poettering c0815ca93d
Merge pull request #10407 from yuwata/netlink-slot
sd-netlink: introduce sd_netlink_slot object and relevant functions
2018-10-18 18:05:58 +02:00
Lennart Poettering 9fd0b02913 smack-setup: include error cause in log message 2018-10-18 16:23:45 +02:00
Lennart Poettering ea8b6526b9 smcak-setup: FOREACH_LINE excorcism 2018-10-18 16:23:45 +02:00
Lennart Poettering a34f0dae01 shutdown: FOREACH_LINE() excorcism 2018-10-18 16:23:45 +02:00
Lennart Poettering 1fb8942284 ima-setup: prefer safe_close() over plain close() 2018-10-18 16:23:45 +02:00
Lennart Poettering b435812c64 ima-setup: include error cause in failure messages 2018-10-18 16:23:45 +02:00
Lennart Poettering 2452419b3a ima-setup: FOREACH_LINE excorcism 2018-10-18 16:23:45 +02:00
Lennart Poettering c66e60a838 cgroup: FOREACH_LINE excorcism 2018-10-18 16:23:45 +02:00
Anita Zhang 90fc172e19 core: implement per unit journal rate limiting
Add LogRateLimitIntervalSec= and LogRateLimitBurst= options for
services. If provided, these values get passed to the journald
client context, and those values are used in the rate limiting
function in the journal over the the journald.conf values.

Part of #10230
2018-10-18 09:56:20 +02:00
Yu Watanabe 103341f9f8
Merge pull request #10438 from poettering/path-is-valid
be a bit more carful when processing transient socket paths via the bus
2018-10-18 06:20:41 +09:00
Lennart Poettering 108e8de655
Merge pull request #10439 from poettering/job-struct-init
three trivial simplifications/clean-ups
2018-10-17 22:55:00 +02:00
Lennart Poettering 67f5d31b45
Merge pull request #10440 from poettering/fflush-and-check-some-more
use fflush_and_check() and free_and_replace() where we can
2018-10-17 22:54:34 +02:00
Lennart Poettering a42984dbc7
Merge pull request #10428 from keszybz/failure-actions
Implement manager status changes using SuccessAction=
2018-10-17 21:29:10 +02:00
Lennart Poettering efa3f34e84 service: use free_and_replace() where we can 2018-10-17 21:24:04 +02:00
Lennart Poettering 7d853ca6bc execute: shorten things a bit 2018-10-17 21:18:09 +02:00
Lennart Poettering 15ec102145 job: add lots of colons to log messages 2018-10-17 21:18:09 +02:00
Lennart Poettering 08ac00f279 job: use structured initialization 2018-10-17 21:18:02 +02:00
Lennart Poettering 1f7817f8e9 core: use structured initialization 2018-10-17 21:13:02 +02:00
Lennart Poettering 1fe84279f7 core: shorten list appending a bit, by using better macros 2018-10-17 21:13:02 +02:00
Lennart Poettering 4ad25546e7 dbus: add missing OOM check 2018-10-17 21:13:02 +02:00
Lennart Poettering 6e9c4f450e core: validate socket path with path_is_valid() 2018-10-17 21:13:02 +02:00
Zbigniew Jędrzejewski-Szmek c7adcb1af9 core: do not "warn" about mundane emergency actions
For example in a container we'd log:
Oct 17 17:01:10 rawhide systemd[1]: Started Power-Off.
Oct 17 17:01:10 rawhide systemd[1]: Forcibly powering off: unit succeeded
Oct 17 17:01:10 rawhide systemd[1]: Reached target Power-Off.
Oct 17 17:01:10 rawhide systemd[1]: Shutting down.
and on the console we'd write (in red)
[  !!  ] Forcibly powering off: unit succeeded

This is not useful in any way, and the fact that we're calling an "emergency action"
is an internal implementation detail. Let's log about c-a-d and the watchdog actions
only.
2018-10-17 19:32:09 +02:00
Zbigniew Jędrzejewski-Szmek a400bd8c2a units: allow and use SuccessAction=exit-force in system systemd-exit.service
C.f. 287419c119ef961db487a281162ab037eba70c61: 'systemctl exit 42' can be
used to set an exit value and pulls in exit.target, which pulls in systemd-exit.service,
which calls org.fdo.Manager.Exit, which calls method_exit(), which sets the objective
to MANAGER_EXIT. Allow the same to happen through SuccessAction=exit.

v2: update for 'exit' and 'exit-force'
2018-10-17 19:32:07 +02:00
Zbigniew Jędrzejewski-Szmek 1710d4beff core: limit service-watchdogs=no to actual "watchdog" commands
The setting is now only looked at when considering an action for a job timeout
or unit start limit. It is ignored for ctrl-alt-del, SuccessAction, SuccessFailure.

v2: turn the parameter into a flag field
v3: rename Options to Flags
2018-10-17 19:31:50 +02:00
Zbigniew Jędrzejewski-Szmek 3f00d379fa core: allow services with no commands but SuccessAction set 2018-10-17 19:31:50 +02:00
Zbigniew Jędrzejewski-Szmek 469f76f170 core: accept system mode emergency action specifiers with a warning
Before we would only accept those "system" values, so there wasn't other
chocie. Let's provide backwards compatiblity in case somebody made use of
this functionality in user mode.

v2: use 'exit-force' not 'exit'
v3: use error value in log_syntax
2018-10-17 19:31:50 +02:00
Zbigniew Jędrzejewski-Szmek 54fcb6192c core: define "exit" and "exit-force" actions for user units and only accept that
We would accept e.g. FailureAction=reboot-force in user units and then do an
exit in the user manager. Let's be stricter, and define "exit"/"exit-force" as
the only supported actions in user units.

v2:
- rename 'exit' to 'exit-force' and add new 'exit'
- add test for the parsing function
2018-10-17 19:31:49 +02:00
Zbigniew Jędrzejewski-Szmek ef5ae8e713 core: consider service with no start command immediately started
The service would always be in state == SERVICE_INACTIVE, but it needs to go
through state == SERVICE_START so that SuccessAction/FailureAction are executed.
2018-10-17 19:28:16 +02:00
Lennart Poettering 8aeb1d3176
Merge pull request #10244 from poettering/nofile-bump
bump RLIMIT_NOFILE
2018-10-17 17:59:36 +02:00
Zbigniew Jędrzejewski-Szmek c02b6ee496 meson: define @HIGH_RLIMIT_NOFILE@ and use it everywhere 2018-10-17 14:54:48 +02:00
Lennart Poettering c8884aceef main: introduce a define HIGH_RLIMIT_MEMLOCK similar to HIGH_RLIMIT_NOFILE 2018-10-17 14:40:44 +02:00
Lennart Poettering a8b627aaed main: bump fs.nr_open + fs.max-file to their largest possible values
After discussions with kernel folks, a system with memcg really
shouldn't need extra hard limits on file descriptors anymore, as they
are properly accounted for by memcg anyway. Hence, let's bump these
values to their maximums.

This also adds a build time option to turn thiss off, to cover those
users who do not want to use memcg.
2018-10-17 14:40:39 +02:00
Yu Watanabe d0955f0091 core: replace udev_monitor by sd_device_monitor 2018-10-17 03:31:20 +09:00
Yu Watanabe 8da2f9e807
Merge pull request #10412 from poettering/sockaddr-sun-path
various fixes related to struct sockaddr_un handling
2018-10-17 01:25:58 +09:00
Lennart Poettering 6dd91b3682 tree-wide: CMP()ify all the things
Let's employ coccinelle to fix everything up automatically for us.
2018-10-16 17:45:53 +02:00
Lennart Poettering a17c17122c core: bump RLIMIT_NOFILE soft+hard limit for systemd itself in all cases
Previously we'd do this for PID 1 only. Let's do this when running in
user mode too, because we know we can handle it.
2018-10-16 16:33:55 +02:00
Lennart Poettering 52d6207578 core: raise the RLIMIT_NOFILE hard limit for all services by default
Following the discussions with the kernel folks, let's substantially
increase the hard limit (but not the soft limit) of RLIMIT_NOFILE to
256K for all services we start.

Note that PID 1 itself bumps the limit even further, to the max the
kernel allows. We can deal with that after all.
2018-10-16 16:33:55 +02:00
Lennart Poettering cdc2af3e15 core: log about unit_watch_pid() failing
CID 1237509
2018-10-16 13:52:21 +02:00
Yu Watanabe 8190a388a6 sd-netlink: make sd_netlink_slot take its description 2018-10-16 18:42:23 +09:00