How Do Ulimit Settings Impact Linux Server Faul
-
Teams
Ask questions, find answers and collaborate at work with Stack Overflow for Teams.
How do ulimit settings impact Linux?
Asked 8 years, 11 months ago
Modified 5 years, 7 months ago
Viewed 38k times
11
Lately, I had a EAGAIN error with some async code that made me take a closer look at ulimit settings. While I clearly understand certain limits, such as nofile, others are still quite confused to me.
It’s quite easy to find resources on how to set those, but I couldn’t find any article explaining precisely what each setting is about and how that could impact the system.
Definition taken from /etc/security/limits.conf is not really self-explanatory:
- 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
- chroot - change root to directory (Debian-specific)
So I’d be glad if someone could enlighten me on those rather important Linux settings!
The error I face is actually:
{ [Error: spawn mediainfo EAGAIN]
code: 'EAGAIN',
errno: 'EAGAIN',
syscall: 'spawn mediainfo',
path: 'mediainfo',
spawnargs:
[ '--Output=XML',
'/home/buzut/testMedia' ],
cmd: 'mediainfo --Output=XML /home/buzut/testMedia' }
As per the definition on gnu.org:
An operation that would block was attempted on an object that has non-blocking mode selected. Trying the same operation again will block until some external condition makes it possible to read, write, or connect (whatever the operation).
I understand that EAGAIN error refers to a resource that is temporarily not available. It wouldn’t be wise to set all parameters to unlimited. Thus I would understand the implication of which params to identify the one blocking and adjust – ulimit settings, my code or both – accordingly.
Here are my current limits:
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 127698
max locked memory (kbytes, -l) 64
max memory size (kbytes, -m) unlimited
open files (-n) 64000
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 127698
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
](https://serverfault.com/users/3038/sysadmin1138)
136k
1919 gold badges
183183 silver badges
306306 bronze badges
asked Apr 28, 2016 at 14:38
](https://serverfault.com/users/145978/buzut)
895
33 gold badges
1111 silver badges
2323 bronze badges
2 Answers
Sorted by:
20
I have made my homework and (almost) found what each option does. Also, I’ve noted that there is more options in /etc/security/limits.conf than it appears with ulimit -a. Therefore, I’ve only documented the latter here. Of course, everyone is invited to enrich this answer!
-
core file size (blocks, -c)
The maximum size of core files created. Core dump is a system snapshot (RAM + context switch + processor registers).
https://en.wikipedia.org/wiki/Core_dump
-
data seg size (kbytes, -d)
The maximum size of a process’s data segment. a data segment is a portion of an object file or the corresponding virtual address space of a program that contains initialised static variables.
https://en.wikipedia.org/wiki/Data_segment
-
scheduling priority (-e)
The maximum scheduling priority (“nice”) a process can be given.
https://en.wikipedia.org/wiki/Scheduling_%28computing%29
-
file size (blocks, -f)
The maximum size of files written by the shell and its children.
-
pending signals (-i)
Set of signals that are pending for delivery to the calling thread.
https://unix.stackexchange.com/questions/197600/what-are-pending-signals
-
max locked memory (kbytes, -l)
The maximum size that may be locked into memory. Memory locking ensures the memory is always in RAM and never moved to the swap disk.
https://stackoverflow.com/questions/9818755/why-would-we-need-to-lock-a-processs-address-space-in-ram
-
max memory size (kbytes, -m)
How much memory a process currently has in main memory (RAM), opposed to how much virtual memory the process has in total.
https://en.wikipedia.org/wiki/Resident_set_size
-
open files (-n)
The maximum number of open file descriptors. A file descriptor is an abstract indicator used to access a file or other input/output resource, such as a pipe or network socket.
https://en.wikipedia.org/wiki/File_descriptor
List file descriptors: http://www.cyberciti.biz/tips/linux-procfs-file-descriptors.html
-
pipe size (512 bytes, -p)
Pipe’s internal buffer size. See “pipe capacity” section in http://man7.org/linux/man-pages/man7/pipe.7.html
-
POSIX message queues (bytes, -q)
The maximum number of bytes in POSIX message queues. POSIX message queues allow processes to exchange data in the form of messages.
http://linux.die.net/man/7/mq_overview
Message queues in general https://en.wikipedia.org/wiki/Message_queue
-
real-time priority (-r)
The maximum real-time scheduling priority. A realtime priority thread can never be pre-empted by timer interrupts and runs at a higher priority than any other thread in the system.
https://stackoverflow.com/questions/1663993/what-is-the-realtime-setting-for-for-process-priority
-
stack size (kbytes, -s)
The maximum stack size. The stack size is a reserved region of memory that is used to store the location of function calls in order to allow return statements to return to the correct location.
https://en.wikipedia.org/wiki/Stack-based_memory_allocation
-
cpu time (seconds, -t)
The maximum amount of cpu time in seconds.
https://en.wikipedia.org/wiki/CPU_time
-
max user processes (-u)
The maximum number of processes a user can start or fork.
https://en.wikipedia.org/wiki/Process_%28computing%29
This command shows how much processes each user is currently using:
ps h -Led -o user | sort | uniq -c | sort -n
-
virtual memory (kbytes, -v)
The maximum amount of virtual memory available to the shell. Virtual memory maps memory addresses used by a program, called virtual addresses, into physical addresses in computer memory.
https://en.wikipedia.org/wiki/Virtual_memory
-
file locks (-x)
File locking is a mechanism that restricts access to a computer file by allowing only one user or process access at any specific time.
https://en.wikipedia.org/wiki/File_locking
](https://serverfault.com/users/537813/mopurizwarriors)
3
33 bronze badges
answered Apr 28, 2016 at 21:42
](https://serverfault.com/users/145978/buzut)
895
33 gold badges
1111 silver badges
2323 bronze badges
1
As you didn’t mention what’s your exact problem with limitation in Linux so it would be hard to fix it. You use ulimit -a for check all of you limitation in OS. Also you can change every limitation you have ( you can decrease it not increase except root can do anything ) Try to look at man ulimit to find out which option you need to change.
answered Apr 28, 2016 at 14:44
](https://serverfault.com/users/351937/ali-ghasempour)
111
22 bronze badges
-
I edited my question to make my problem clearer. But beside that, I’d be glad to know which param does what (like
nofileis the number of files a given user can have open simultaneously)!– Buzut
-
Unlimiteddidn’t fix your problem ? -
I didn’t try
unlimitedso far. I changednofilesfrom1024to64000, but it didn’t solve my problem. And I’d rather not change what I don’t understand. And clearly, I don’t know what others do…– Buzut
-
1
Only option you shouldn’t change is
core!!! Core is env + bug log of applications. Put it on default (zero ) if you don’t your disk will be full soon. First check your limitationulimit -athen tryunlimited -
1
I don’t know what kind of resource you mean but options
cpu( how much user take CPU for its process ) andnproc( max number of process user can make or fork ) . Hope these will help you. Have fun ;)
You must log in to answer this question.
Start asking to get answers
Find the answer to your question by asking.
Explore related questions
See similar questions with these tags.
- The Overflow Blog
- Featured on Meta
- Changes to reporting for the [status-review] escalation process
Related
1506How can I sort du -h output by size
409How to run a server on port 80 as a normal user on Linux?
1What are some basic ulimit settings for a student shared server?
45where are the default ulimit values set? (linux, centos)
1Ulimit settings in Oracle 11g on Linux 5
210GbE be2net low pktgen performance
28How to set ulimit value permanently?
0PHP Sockets. Better on multiple ports or not?
0Trying to understand sysbench
Hot Network Questions
- Avoiding alligators with primitive technology?
- Is John Brandenburg affiliated with Harvard University?
- How to make chocolate easter egg without a mould?
- Unexpected results when mixing highly concentrated CuCl2 with Al foil
- Difference in weights between two submerged objects
- Why exactly is the Riemann integral not adequate for representing linear functionals?
- Is there a common description of the way Trump pronounces things he doesn’t like?
- How to apply the libertine font to a specific range in pdfLaTeX?
- Should I be worried about this heat shield damage?
- How can I replace one space with N spaces?
- If Jesus knew all about the fig tree, why was he ignorant about it not being in season? Matthew 21:18-20 cf. Matthew 24:32-33
- Can we slightly modify the Schwarzschild metric to describe an evaporating black hole, and what would the geodesic be like?
- How do astronomers know that two objects appearing near one another are in fact close?
- How is maximum age handled in templated creatures?
- Are there any documented cases where Percival Treite committed any procedures that led to death?
- Is the development of AI inevitable?
- Should I use page numbers when citing information from physics papers?
- Writing Without Overplanning: How?
- Merging sublists together based upon element criteria
- Asymptotics of alternating sum of squared binomials by contour integration
- Why is my new bike so slow
- Does time dilation affect the date when arriving at a destination?
- Which Hyrule Compendium entries can be missed?
- Why is mechanical energy lost and linear momentum not conserved when a string suddenly becomes taut in a vertical two-mass system?
Server Fault
Company
Stack Exchange Network
- Technology
- Culture & recreation
- Life & arts
- Science
- Professional
- Business
- API
- Blog
Site design / logo © 2025 Stack Exchange Inc; user contributions licensed under CC BY-SA . rev 2025.4.9.24965
By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.