-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Limit* should allow setting soft and hard limits to different values #1769
Comments
Hmm, what's the precise usecase for this? So far I was reluctant to support this, in order to avoid having too many redudant options, as I didn't see a strong usecase for this... Do you have one? |
Well as an example, we have an app where we set a low soft limit and a higher hard limit. The app can also set and modify the soft limit later with the hard limit being a final safety. So why set the soft limit externally too? Because we've had the internal configuration code that manages the soft limit fail to apply at all due to bugs in the code which went uncaught until it hit production. This failure mode is much less severe when starting from a properly set low limit. That's one use case, there are probably others. It seems like adding this changes almost nothing about the interface (you still have one option that can now take 1 argument or optionally 2) that allows folks to migrate existing settings you'd expect to exist having looked at man setrlimit and the rlimit struct. I don't see a lot of redundancy here. |
Note that prlimit(1) uses this convention:
(it would be nice to use the same in case you decide we really need it for systemd) |
@karelzak yes, that syntax looks useful, makes sense to adopt. |
@kcbraunschweig that's not really a concise usecase description. |
Either way, I see no problem adding this, if somebody sends a patch that implements the syntax @karelzak suggested, hence leaving this as an RFE bug. |
I'll try to prepare a patch. |
My suggestion has been to support "value", "soft:hard", "soft:" and ":hard". The last two possibilities are a little bit tricky. What default value is expected when incomplete rlimit range (e.g. "soft:") is specified in the unit files? For example LimitAS=1G: to specify 1 GiB soft limit, what is the hard limit for this resource? It would be possible to use the global DefaultLimitAS or we can keep it simple and support "value" and "soft:hard" syntax only (it means require always complete range). Comments? |
OK, I have decided that "value" and "soft:hard" syntax is enough. We do not need to support incomplete ranges like "soft:" and ":hard". |
"value" and "soft:hard" would work well for our usecase, I don't see a need for incomplete ranges either. |
The new parser supports: <value> - specify both limits to the same value <soft:hard> - specify both limits the size or time specific suffixes are supported, for example LimitRTTIME=1sec LimitAS=4G:16G The patch introduces parse_rlimit_range() and rlim type (size, sec, usec, etc.) specific parsers. No code is duplicated now. References: systemd#1769
The new parser supports: <value> - specify both limits to the same value <soft:hard> - specify both limits the size or time specific suffixes are supported, for example LimitRTTIME=1sec LimitAS=4G:16G The patch introduces parse_rlimit_range() and rlim type (size, sec, usec, etc.) specific parsers. No code is duplicated now. The patch also sync docs for DefaultLimitXXX= and LimitXXX=. References: systemd#1769
Closing, as #1994 got merged. |
The new parser supports: <value> - specify both limits to the same value <soft:hard> - specify both limits the size or time specific suffixes are supported, for example LimitRTTIME=1sec LimitAS=4G:16G The patch introduces parse_rlimit_range() and rlim type (size, sec, usec, etc.) specific parsers. No code is duplicated now. The patch also sync docs for DefaultLimitXXX= and LimitXXX=. References: systemd/systemd#1769 Cherry-picked from: 91518d2 Resolves: #1351415
The new parser supports: <value> - specify both limits to the same value <soft:hard> - specify both limits the size or time specific suffixes are supported, for example LimitRTTIME=1sec LimitAS=4G:16G The patch introduces parse_rlimit_range() and rlim type (size, sec, usec, etc.) specific parsers. No code is duplicated now. The patch also sync docs for DefaultLimitXXX= and LimitXXX=. References: systemd/systemd#1769 Cherry-picked from: 91518d2 Resolves: #1351415
The new parser supports: <value> - specify both limits to the same value <soft:hard> - specify both limits the size or time specific suffixes are supported, for example LimitRTTIME=1sec LimitAS=4G:16G The patch introduces parse_rlimit_range() and rlim type (size, sec, usec, etc.) specific parsers. No code is duplicated now. The patch also sync docs for DefaultLimitXXX= and LimitXXX=. References: systemd/systemd#1769 Cherry-picked from: 91518d2 Resolves: #1351415
The new parser supports: <value> - specify both limits to the same value <soft:hard> - specify both limits the size or time specific suffixes are supported, for example LimitRTTIME=1sec LimitAS=4G:16G The patch introduces parse_rlimit_range() and rlim type (size, sec, usec, etc.) specific parsers. No code is duplicated now. The patch also sync docs for DefaultLimitXXX= and LimitXXX=. References: systemd/systemd#1769 Cherry-picked from: 91518d20ddf0376808544576d0ef0883cedc67d4 Resolves: #1351415
Using the Limit* options (e.g. LimitAS) there is no way to set the soft and the hard limit to different values (e.g., set soft to 1G and hard to 5G). It'd be useful to extend these options to that an extra optional argument to set the hard limit to a different value; e.g.
LimitAS=1G,5G
The text was updated successfully, but these errors were encountered: