I have an issue where a process has a different max file size than the ulimit for a user. The log file for this process is basically not growing past 524288
proc:
less /proc/20238/limits
Limit Soft Limit Hard Limit Units
...
Max file size 524288 524288 bytes
...
ulimit:
ulimit -a
...
file size (blocks, -f) unlimited
...
From what I can tell, there is no ulimit being set in the script that starts the process.
I have also looked at /etc/security/limits.conf
but that only has entries for nofile
and nproc
Q: Do you have any idea what else could be setting the file size limit?
If it is any help, here is a scrubbed version of what starts the process:
nohup java $WALLET_OPTS -DOracleName="FileSender" -DAPP=FILE_SDR -Dapp_props=$APP_PROPS -Dfile_name=${FILE_NAME} -XX:+UseParallelGC -XX:+DisableExplicitGC -XX:-EliminateLocks $APPMEM -DDEBUG_MQSERVER=TRUE -classpath $CLASSPATH com.some.path.FileSdrSrv 10 1>> $APP_LOG/filesdr.log 2>&1 &
The java file doesn't set the ulimit either.
Ulimits are inherited from the parent process, if f.e. you login as root and su to the user. You WILL get different limits, than when logging directly onto the user.
The same issue is with start scripts if it's sysvinit. It's a bit different with systemd, but not by much.
PAM configuration decides in which cases are the limits loaded. You can check it in the man.
You should check if there are any files in
/etc/security/limits.d/*.conf
as they might override the defaults.IIRC the defaults are set in limits.h, but I don't remember it's location on rhel5.
In systems using systemctl to manage services like centos 7, there is a special place to set limits for systemctl services. You can put a config file in folder
/etc/systemd/system/$service_name.service.d/
to overwrite the ulimit. You can put the configurations in service definition files too.Example:
The above configuration will overwrite the "file size limit" of the service.
see
Edit open file limit for SysV service in CentOS 7
https://fredrikaverpil.github.io/2016/04/27/systemd-and-resource-limits/
https://www.freedesktop.org/software/systemd/man/systemd.exec.html#Process%20Properties
Application can limit the resources when starting up, it is always possible to set up more strict resource limits than the configured value of the user. See following example: