CentOS Bug Tracker
CentOS Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0005137CentOS-6pampublic2011-09-22 16:492012-05-18 20:23
Reporterdovid 
PrioritynormalSeverityminorReproducibilityalways
StatusnewResolutionopen 
PlatformOSOS Version
Product Version6.0 
Target VersionFixed in Version 
Summary0005137: System not following ulimit when launching scripts
DescriptionHi,

I am not certain this is a bug bit it seems so based on previous behavior. The issue is that when we run a script we do not get what is set in limits.conf


On a system with CentOs 5.6 for /etc/security/limits.conf we have:

[root@brian ~]# cat /etc/security/limits.conf
# /etc/security/limits.conf
#
#Each line describes a limit for a user in the form:
#
#<domain> <type> <item> <value>
#
#Where:
#<domain> can be:
# - an user name
# - a group name, with @group syntax
# - the wildcard *, for default entry
# - the wildcard %, can be also used with %group syntax,
# for maxlogin limit
#
#<type> can have the two values:
# - "soft" for enforcing the soft limits
# - "hard" for enforcing hard limits
#
#<item> can be one of the following:
# - core - limits the core file size (KB)
# - data - max data size (KB)
# - fsize - maximum filesize (KB)
# - memlock - max locked-in-memory address space (KB)
# - nofile - max number of open files
# - rss - max resident set size (KB)
# - stack - max stack size (KB)
# - cpu - max CPU time (MIN)
# - nproc - max number of processes
# - as - address space limit
# - maxlogins - max number of logins for this user
# - maxsyslogins - max number of logins on the system
# - priority - the priority to run user process with
# - locks - max number of file locks the user can hold
# - sigpending - max number of pending signals
# - msgqueue - max memory used by POSIX message queues (bytes)
# - nice - max nice priority allowed to raise to
# - rtprio - max realtime priority
#
#<domain> <type> <item> <value>
#

#* soft core 0
#* hard rss 10000
#@student hard nproc 20
#@faculty soft nproc 20
#@faculty hard nproc 50
#ftp hard nproc 0
#@student - maxlogins 4

# End of file
* hard nofile 65535
* soft nofile 65535
* hard nproc 65535
* soft nproc 65535

When doing ulimit -n we get:
[root@brian ~]# ulimit -n
65535

When doing look at the limits for a process we have:
[root@brian ~]# cat /proc/9216/limits
Limit Soft Limit Hard Limit Units
Max cpu time unlimited unlimited seconds
Max file size unlimited unlimited bytes
Max data size unlimited unlimited bytes
Max stack size 10485760 unlimited bytes
Max core file size 0 unlimited bytes
Max resident set unlimited unlimited bytes
Max processes 65535 65535 processes
Max open files 65535 65535 files
Max locked memory 32768 32768 bytes
Max address space unlimited unlimited bytes
Max file locks unlimited unlimited locks
Max pending signals 38912 38912 signals
Max msgqueue size 819200 819200 bytes
Max nice priority 0 0
Max realtime priority 0 0

If we do the same on a System running CentOs 6.0 for the same script we get:
[root@meg ~]# cat /etc/security/limits.conf
# /etc/security/limits.conf
#
#Each line describes a limit for a user in the form:
#
#<domain> <type> <item> <value>
#
#Where:
#<domain> can be:
# - an user name
# - a group name, with @group syntax
# - the wildcard *, for default entry
# - the wildcard %, can be also used with %group syntax,
# for maxlogin limit
#
#<type> can have the two values:
# - "soft" for enforcing the soft limits
# - "hard" for enforcing hard limits
#
#<item> can be one of the following:
# - core - limits the core file size (KB)
# - data - max data size (KB)
# - fsize - maximum filesize (KB)
# - memlock - max locked-in-memory address space (KB)
# - nofile - max number of open files
# - rss - max resident set size (KB)
# - stack - max stack size (KB)
# - cpu - max CPU time (MIN)
# - nproc - max number of processes
# - as - address space limit (KB)
# - maxlogins - max number of logins for this user
# - maxsyslogins - max number of logins on the system
# - priority - the priority to run user process with
# - locks - max number of file locks the user can hold
# - sigpending - max number of pending signals
# - msgqueue - max memory used by POSIX message queues (bytes)
# - nice - max nice priority allowed to raise to values: [-20, 19]
# - rtprio - max realtime priority
#
#<domain> <type> <item> <value>
#

#* soft core 0
#* hard rss 10000
#@student hard nproc 20
#@faculty soft nproc 20
#@faculty hard nproc 50
#ftp hard nproc 0
#@student - maxlogins 4

# End of file
* hard nofile 65535
* soft nofile 65535
* hard nproc 65535
* soft nproc 65535

for ulimit -n:
[root@meg ~]# ulimit -n
65535

When doing look at the limits for the exact same process we have:
[root@meg ~]# cat /proc/26044/limits
Limit Soft Limit Hard Limit Units
Max cpu time unlimited unlimited seconds
Max file size unlimited unlimited bytes
Max data size unlimited unlimited bytes
Max stack size 10485760 unlimited bytes
Max core file size 0 unlimited bytes
Max resident set unlimited unlimited bytes
Max processes 1024 65535 processes
Max open files 65535 65535 files
Max locked memory 65536 65536 bytes
Max address space unlimited unlimited bytes
Max file locks unlimited unlimited locks
Max pending signals 30524 30524 signals
Max msgqueue size 819200 819200 bytes
Max nice priority 0 0
Max realtime priority 0 0
Max realtime timeout unlimited unlimited us


It seems with CentOS 5.x we can rely on the OS to set it yet in 6.0 in order to get around this we need to set it by doing:
        ulimit -s unlimited
        ulimit -Hn 65535
        ulimit -n 65535
in the init script.



TagsNo tags attached.
Attached Files

- Relationships

-  Notes
(0013547)
dovid (reporter)
2011-10-16 06:50

Ping
(0015103)
tupari (reporter)
2012-05-18 20:11

I'm also seeing ulimit weirdness. I was setting nproc in limits.conf but the changes were not taking effect. The workaround of using an id range in stead of * given in https://www.centos.org/modules/newbb/viewtopic.php?topic_id=35462 [^] worked for me.

This is on a CentOS 6.2 system with pam 1.1.1

I think the severity of this should be bumped up from minor.
(0015104)
tupari (reporter)
2012-05-18 20:23

Able to verify in Fedora 15. Filed bug: https://bugzilla.redhat.com/show_bug.cgi?id=823030 [^]

- Issue History
Date Modified Username Field Change
2011-09-22 16:49 dovid New Issue
2011-10-16 06:50 dovid Note Added: 0013547
2012-05-18 20:11 tupari Note Added: 0015103
2012-05-18 20:23 tupari Note Added: 0015104


Copyright © 2000 - 2014 MantisBT Team
Powered by Mantis Bugtracker