Linux – proc’s limit and ulimit -f don’t match

linuxprocrhel5ulimit

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. 

Best Answer

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.