Bug 1396277 - BZ 1351415 change appears to have broken ability to set limits.
Summary: BZ 1351415 change appears to have broken ability to set limits.
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: systemd
Version: 7.3
Hardware: All
OS: All
Target Milestone: rc
: ---
Assignee: systemd-maint
QA Contact: Branislav Blaškovič
: 1397947 1402699 1408315 (view as bug list)
Depends On:
Blocks: 1446211 74systemd 1399638
TreeView+ depends on / blocked
Reported: 2016-11-17 20:54 UTC by Chris Cheney
Modified: 2020-05-14 15:25 UTC (History)
14 users (show)

Fixed In Version: systemd-219-31.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1399638 (view as bug list)
Last Closed: 2017-08-01 09:12:22 UTC
Target Upstream Version:

Attachments (Terms of Use)

System ID Private Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 2854131 0 None None None 2017-02-17 19:26:29 UTC
Red Hat Product Errata RHBA-2017:2297 0 normal SHIPPED_LIVE systemd bug fix and enhancement update 2017-08-01 12:40:16 UTC

Description Chris Cheney 2016-11-17 20:54:44 UTC
The patches for BZ 1351415 do not seem to work at all and actually broke previously working functionality from RHEL 7.2. Tried with just one value and with two values (soft/hard) and neither works.










Nov 17 23:26:42 dhcp9-127.gsslab.pnq.redhat.com systemd[1]: [/etc/systemd/system/httpd.service.d/ulimit.conf:2] Failed to parse resource value, ignoring: 10485760
Nov 18 01:24:50 dhcp9-127.gsslab.pnq.redhat.com systemd[1]: [/etc/systemd/system/httpd.service.d/ulimit.conf:2] Failed to parse resource value, ignoring: 10485760
Nov 18 01:29:49 dhcp9-127.gsslab.pnq.redhat.com systemd[1]: [/etc/systemd/system/httpd.service.d/ulimit.conf:2] Failed to parse resource value, ignoring: 10M
Nov 18 02:10:27 dhcp9-127.gsslab.pnq.redhat.com systemd[1]: [/etc/systemd/system/httpd.service.d/ulimit.conf:2] Failed to parse resource value, ignoring: 10485760:10485760
Nov 18 02:15:35 dhcp9-127.gsslab.pnq.redhat.com systemd[1]: [/etc/systemd/system/httpd.service.d/stack.conf:2] Failed to parse resource value, ignoring: 10485760:10485760


Package versions:


Comment 3 Michal Sekletar 2016-11-18 15:02:28 UTC
I figured out what is going on here. While backporting fixes for #1351415 I didn't realize that new code for parsing LimitSTACK values does work correctly only when uint64_t is used for u variable in rlim_parse_size function. However our old code base uses off_t and due to invalid cast we always return -ERANGE error.

Unfortunately, we didn't catch this because our test suite doesn't test LimitSTACK.

Proposed fix,


Comment 5 Branislav Blaškovič 2016-11-23 12:30:31 UTC
qa acking for 7.4

Comment 6 Jan Synacek 2016-11-24 11:34:02 UTC
*** Bug 1397947 has been marked as a duplicate of this bug. ***

Comment 8 Lukáš Nykrýn 2016-11-29 09:47:16 UTC
fix merged to upstream staging branch ->
-> post

Comment 11 masanari iida 2016-12-14 01:55:50 UTC
I reported the same issue as bz#1402699 without knowing this one already exist.
But in this BZ case, you only discuss about issue with LimitSTACK.
And as I see the fix in github, the engineer added a code regarding
LimitSTACK only. 

+        assert_se(config_parse_bytes_limit(NULL, "fake", 1, "section", 1, "LimitSTACK", RLIMIT_STACK, "55", rl, NULL) >= 0);
+        assert_se(rl[RLIMIT_STACK]);
+        assert_se(rl[RLIMIT_STACK]->rlim_cur == 55);
+        assert_se(rl[RLIMIT_STACK]->rlim_cur == rl[RLIMIT_STACK]->rlim_max);
I have experienced the issue with LimitMEMLOCK as well. :(


Error log.
systemd[1]: [/etc/systemd/system/my-local.service:13] Failed to parse resource value, ignoring: 5432100

So would you mind to check if your latest branch for RHEL's systemd 
still have the issue with LimitMEMLOCK?

Comment 12 Keigo Noha 2016-12-14 01:56:40 UTC
*** Bug 1402699 has been marked as a duplicate of this bug. ***

Comment 13 Jan Synacek 2016-12-14 07:29:07 UTC
The patch applies for all of the following, because they all use the same parser (the property_get_rlimit()):

src/core/dbus-execute.c:        SD_BUS_PROPERTY("LimitCPU", "t", property_get_rlimit, offsetof(ExecContext, rlimit[RLIMIT_CPU]), SD_BUS_VTABLE_PROPERTY_CONST),
src/core/dbus-execute.c:        SD_BUS_PROPERTY("LimitFSIZE", "t", property_get_rlimit, offsetof(ExecContext, rlimit[RLIMIT_FSIZE]), SD_BUS_VTABLE_PROPERTY_CONST),
src/core/dbus-execute.c:        SD_BUS_PROPERTY("LimitDATA", "t", property_get_rlimit, offsetof(ExecContext, rlimit[RLIMIT_DATA]), SD_BUS_VTABLE_PROPERTY_CONST),
src/core/dbus-execute.c:        SD_BUS_PROPERTY("LimitSTACK", "t", property_get_rlimit, offsetof(ExecContext, rlimit[RLIMIT_STACK]), SD_BUS_VTABLE_PROPERTY_CONST),
src/core/dbus-execute.c:        SD_BUS_PROPERTY("LimitCORE", "t", property_get_rlimit, offsetof(ExecContext, rlimit[RLIMIT_CORE]), SD_BUS_VTABLE_PROPERTY_CONST),
src/core/dbus-execute.c:        SD_BUS_PROPERTY("LimitRSS", "t", property_get_rlimit, offsetof(ExecContext, rlimit[RLIMIT_RSS]), SD_BUS_VTABLE_PROPERTY_CONST),
src/core/dbus-execute.c:        SD_BUS_PROPERTY("LimitNOFILE", "t", property_get_rlimit, offsetof(ExecContext, rlimit[RLIMIT_NOFILE]), SD_BUS_VTABLE_PROPERTY_CONST),
src/core/dbus-execute.c:        SD_BUS_PROPERTY("LimitAS", "t", property_get_rlimit, offsetof(ExecContext, rlimit[RLIMIT_AS]), SD_BUS_VTABLE_PROPERTY_CONST),
src/core/dbus-execute.c:        SD_BUS_PROPERTY("LimitNPROC", "t", property_get_rlimit, offsetof(ExecContext, rlimit[RLIMIT_NPROC]), SD_BUS_VTABLE_PROPERTY_CONST),
src/core/dbus-execute.c:        SD_BUS_PROPERTY("LimitMEMLOCK", "t", property_get_rlimit, offsetof(ExecContext, rlimit[RLIMIT_MEMLOCK]), SD_BUS_VTABLE_PROPERTY_CONST),
src/core/dbus-execute.c:        SD_BUS_PROPERTY("LimitLOCKS", "t", property_get_rlimit, offsetof(ExecContext, rlimit[RLIMIT_LOCKS]), SD_BUS_VTABLE_PROPERTY_CONST),
src/core/dbus-execute.c:        SD_BUS_PROPERTY("LimitSIGPENDING", "t", property_get_rlimit, offsetof(ExecContext, rlimit[RLIMIT_SIGPENDING]), SD_BUS_VTABLE_PROPERTY_CONST),
src/core/dbus-execute.c:        SD_BUS_PROPERTY("LimitMSGQUEUE", "t", property_get_rlimit, offsetof(ExecContext, rlimit[RLIMIT_MSGQUEUE]), SD_BUS_VTABLE_PROPERTY_CONST),
src/core/dbus-execute.c:        SD_BUS_PROPERTY("LimitNICE", "t", property_get_rlimit, offsetof(ExecContext, rlimit[RLIMIT_NICE]), SD_BUS_VTABLE_PROPERTY_CONST),
src/core/dbus-execute.c:        SD_BUS_PROPERTY("LimitRTPRIO", "t", property_get_rlimit, offsetof(ExecContext, rlimit[RLIMIT_RTPRIO]), SD_BUS_VTABLE_PROPERTY_CONST),
src/core/dbus-execute.c:        SD_BUS_PROPERTY("LimitRTTIME", "t", property_get_rlimit, offsetof(ExecContext, rlimit[RLIMIT_RTTIME]), SD_BUS_VTABLE_PROPERTY_CONST),

Comment 17 masanari iida 2017-02-20 02:30:24 UTC
As I see KB#2854131,  it explains following parameteres are affected.


I had exactly same problem from a customer, a week ago.
The customer set   DefaultLimitCore in /etc/systemd/system.conf,
But it stop working after the customer updated to systemd-219.30.el7_3.6.

So you should add "DefaultLimixXYZ" parameters in system.conf  are also
affected in the KB#2854131.

Comment 18 Keigo Noha 2017-02-20 02:51:22 UTC
Hello Iida-san,

Thank you for your feedback. I'll update the solution soon.


Comment 19 Keigo Noha 2017-02-23 03:03:12 UTC
Hello Iida-san,

I updated the solution. If you find anything we should modify, please let me know.


Comment 20 masanari iida 2017-02-23 09:35:06 UTC
Thanks for the update of the KB.

Comment 21 Peter Lemenkov 2017-03-13 15:34:46 UTC
*** Bug 1408315 has been marked as a duplicate of this bug. ***

Comment 24 errata-xmlrpc 2017-08-01 09:12:22 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.


Note You need to log in before you can comment on or make changes to this bug.