Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [limit]

Limiting the usage of a resource (memory, disk space, CPU time, open files, network bandwidth, …) by a process or a group of processes.

5
votes
1answer
61 views

dash maximum variable length under systemd

I have a shell script that uses a single variable as an associative array (one KEY=VALUE per line). Throughout the execution of the script, the variable is manipulated to add, remove or modify ...
0
votes
0answers
27 views

Limit container resources both using --memory and --cgroup-parent

I'd like to limit both total memory consumption for a group of containers as well as memory consumption for a particular container. Say, a container is allowed to consume not greater than 1Gb and all ...
1
vote
1answer
47 views

Change max line length of GNU parallel

The following command: parallel --max-line-length-allowed returns 131049. Is this a constant, or can I somehow change this limit?
35
votes
3answers
51k views

Creating threads fails with “Resource temporarily unavailable” with 4.3 kernel

I am running a docker server on Arch Linux (kernel 4.3.3-2) with several containers. Since my last reboot, both the docker server and random programs within the containers crash with a message about ...
0
votes
1answer
14 views

Setting soft limit above hard does not fail in terms of exit code?

root@Andromeda:/# ulimit -n -S 2048 root@Andromeda:/# ulimit -n -H 2048 root@Andromeda:/# ulimit -n -S 4096 2048 root@Andromeda:/# echo $? 0 Failure to set soft limit above the hard one makes sense. ...
10
votes
2answers
2k views

How to solve this memory issue gracefully?

I have a standard Linux (Debian testing) laptop, with a swap partition. I do a lot of experiments with it. Some of them are really memory hungry and the way Linux behaves by default is an issue for ...
3
votes
2answers
1k views

Limiting users ram with cgroups not working (for me)

I registred because I didn't manage running cgroups with several tutorials/comments/whatever you find on google. I want to limit the amount of ram a specifix user may use. Internet says "cgroups". My ...
1
vote
1answer
941 views

How to handle broken link after file deletion.in /proc/<pid>/fd directory?

A process is creating huge number of log files and also deleting it. Many of those deleted files are having broken links in the /proc/pid/fd directory. Do these file handles need to be closed by ...
1
vote
1answer
1k views

Curl parallel download file list

first post sorry if I did some mess here =) Using Ubuntu 14.04lts 64bits server version. I have a list (url.list) with only URLs to download, one per line, that looks like this: http://domain.com/...
3
votes
4answers
3k views

cpulimit on a bash script which runs other commands

I have a bash script which runs other cpu-intensive commands . When I apply cpulimit on the bash script, the output of top shows processes for the commands inside the script still run without ...
3
votes
2answers
529 views

Tool to force use FILE instead of RAM

I'm wondering why there is no such tool like ram2swap, similar to cpulimit in parts. E.g. There is program daemon.bin. Let's create temporary swap file ( 1 Gb ): % dd if=/dev/zero of=tmp.swap bs=...
1
vote
1answer
1k views

iptables limit inbound connections to Docker container

Running an Ubuntu 16.04 server with Docker Engine (latest version 1.12.1) and a Docker image/container based on Ubuntu 16.04 as well. I need to limit (on a specific port using TCP) both: the number ...
1
vote
1answer
35 views

Limit on continuously writing to a log file

I am using Debian running on a BeableBone Black with 4GB of internal flash storage. My program is continuously writing / appending to a log file that I created with >> every minute, all day ...
0
votes
1answer
158 views

Open file limits not increased for redis user despite change in /etc/security/limits.conf

I got ERR max number of clients reached from my redis server so I decidied to increase the allowed max client connections in its configuration. This also requires according to the documentation, ...
0
votes
1answer
237 views

Download error with youtube-dl and axel

I am trying to download following video: https://www.youtube.com/watch?v=pQWj2Fgxdrc by combining 'youtube-dl' and 'axel'. I am trying to download this video in such a way that I want these two ...
4
votes
1answer
1k views

Traffic shaping with tc does not work

I want to limit the outgoing traffic to a specific bandwidth. My Code: tc qdisc add dev vif1.0 root handle 1: htb default 30 tc class add dev vif1.0 parent 1: classid 1:1 htb rate 1mbit tc class add ...
2
votes
2answers
1k views

Time limit for bash script

I have bash script and I would like to set time limit for it. For example if scripts runs longer than 50s, exit with 0. It should be done inside script, I can not change the command how script is ...
4
votes
1answer
9k views

max no of tcp connections on a linux system

I know that /etc/security/limits.conf provides the persistent soft and hard limits for several values. However, in the relevant list there is no indication about imposed limits on: a) concurrent ...
0
votes
0answers
35 views

Limit TCP connections per second for different IP addresses [attacked with 1000 connections with different IP] [duplicate]

How to limit TCP connections per second for different IP addresses? I'm looking for limit per second for different IP's on 25565 port. Limit max connections per IP address and new connections per ...
2
votes
1answer
507 views

How to limit a systemd service to “play nice” with the CPU?

I have a systemd service (a CI runner) that tends to bog the system down with very CPU intensive jobs. I caught the load average flying over 100 just now and want to put a stop to that nonsense. ...
2
votes
0answers
117 views

Restart a process if cpu usage is more than 90% for more than a 60sec

Normally one of my systemd services will take about 0...5% cpu Usage. In some cases it can reach up to 100% but only for some seconds. If the Service "crashes" it takes up to 100% continuously. So I ...
6
votes
1answer
1k views

Can I set a resource limit for the current process tree?

Let's say I'm running on a resource-constrained system, and I want to ensure that the applications I run open no more than 10 files total. If I try to do it using setrlimit, something like: if (fork(...
37
votes
3answers
62k views

How to create a user with limited RAM usage?

So I have 4 GB RAM + 4GB swap. I want to create a user with limited ram and swap: 3 GB RAM and 1 GB swap. Is such thing possible? Is it possible to start applications with limited RAM and swap ...
1
vote
0answers
15 views

Launch a program to only specific resources

Question: How can I launch a program such that it only uses X ram and Y CPU cores, etc? I happen to be using Ubuntu in this case, but since I often am on other distros, I need a general GNU/Linux ...
1
vote
1answer
236 views

Difference between behaviors of setrlimit and limit stack

I am seeing a difference of behavior when setting stack size from shell and from inside my c program. The issue is that I have a function which has a large set of local variables (large arrays). If I ...
11
votes
2answers
13k views

Set default nice value for a given user (limits.conf)

Could someone tell me how to set the default value of nice (as displayed by top) of a user? I have found that /etc/security/limits.conf is the place but if I put either: username_of_a_guy - nice ...
23
votes
8answers
41k views

How to limit log file size using >>

How can I limit the size of a log file written with >> to 200MB? $ run_program >> myprogram.log
1
vote
0answers
188 views

What is the maximum open files limit?

I'm working on a reasonably large project, and recently had to bump the nofile setting above 500,000. I tried to change it to five million in /etc/security/limits.d/99-users-nofile.conf, but ...
9
votes
1answer
21k views

Fixing ulimit: open files: cannot modify limit: Operation not permitted

I tested this on different GNU/Linux installations: perl -e 'while(1){open($a{$b++}, "<" ,"/dev/null") or die $b;print " $b"}' System A and D The first limit I hit is 1024. It is easily raised ...
23
votes
4answers
56k views

Modify ulimit (open files) of a specific process

Is it possible to change the soft - and hard limit of a specific process? In my case, my process is mongod and a lot of web resources tell me to simply execute: ulimit -n <my new value> My ...
11
votes
3answers
47k views

Number of SSH connection(s) on a single linux machine

I landed up in a situation wherein I had to access a Linux machine via puTTY.I made various attempts to SSH but failed to connect to the machine. I then realised my colleague was accessing the same ...
0
votes
1answer
215 views

cgroups: Is it possible to limit cpu usage by process name instead of by pid

As we know, cgroups can limit cpu usage of processes. Here is an example: PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 30142 root 20 0 104m 2520 1024 R 99.7 ...
1
vote
2answers
102 views

Preventing un tar from using too much CPU

I am running un tar i.e tar xzvf abc.tar.gz on Beaglebone green. This seems to be using too much CPU. When a untar operation is in progress, i see via top command the CPU usage.. not sure why it seems ...
1
vote
0answers
143 views

is cgroups limits per user or shared across all members?

for example, group memlimit { memory { #approx 200MB memory.limit_in_bytes = 200000000; } } will all members of memlimit share 200 MB, or will each member individually get ...
0
votes
1answer
54 views

Is there a way to restrict the application access to the system time in linux?

Is there a way to restrict the application access to the system time in linux? I want to make the application launch as much as possible abstracted from the environment. If you can restrict access to ...
1
vote
2answers
170 views

understanding how to run script securely as limited user

I've been building this (http://tryperl.com) to learn linux. So, my question is just about some *nix stuff I don't fully grok. One of the things I want to do is run the generated script (in my ...
2
votes
3answers
7k views

Increasing open files limit for all processes: Do I need to set Soft/Hard limits?

I'm trying to fix the following error that I get after a day or two of running my game server. 2017/12/13 12:08:35 http: Accept error: accept tcp [::]:8081: accept4: too many open files; retrying in ...
3
votes
3answers
2k views

Control Dropbox upload rate on the command line

I'm using Dropbox without the GUI in Linux. I would like to limit the upload rate, sometimes large files eats my internet bandwidth. Anyone knows how I do that?
31
votes
7answers
51k views

Limiting processes to not exceed more than 10% of CPU usage

I operate a Linux system which has a lot of users but sometimes an abuse occurs; where a user might run a single process that uses up more than 80% of the CPU/Memory. So is there a way to prevent ...
0
votes
1answer
338 views

Limiting RAM for a group of users on Ubuntu Machine

I have a gpu based system. Multiple users use the system, as a result, the RAM frequently gets fully utilized leaving no memory for myself. I want to put a maximum RAM limit on all the users except ...
36
votes
3answers
89k views

Limit max connections per IP address and new connections per second with iptables

We have an Ubuntu 12.04 server with httpd on port 80 and we want to limit: the maximum connections per IP address to httpd to 10 the maximum new connections per second to httpd to 150 How can we do ...
2
votes
1answer
2k views

ulimit vs file-max

Could someone explain limit on open files in linux? The problem is that one of my applications if reporting "Too many open files". I have ulimit -n 1024 but cat /proc/sys/fs/file-max 6578523 and ...
1
vote
0answers
146 views

Where does a bash process get its default signal handlers/traps?

From https://stackoverflow.com/questions/50606753/do-getrlimit-and-setrlimit-work-by-reading-from-and-writing-to-etc-sec#comment88227414_50607042 Bash doesn't have a special handler for SIGQUIT ...
13
votes
2answers
14k views

ulimit PICKLE: “Operation not permitted” and “Command not found”

I'm trying to increase the maximum number of open files for the current user > ulimit -n 1024 I attempt to increase and fail as follows > ulimit -n 4096 bash: ulimit: open files: cannot ...
78
votes
7answers
124k views

How do I limit the number of files printed by ls?

Is there a way to limit the quantity of listed files on a ls command? I've seen: ls | head -4 but to get head or tail to be executed I need to wait for ls to finish execution, and with directories ...
2
votes
2answers
2k views

How to limit the number of open files for nfsd with systemd

It's fairly straightforward to control open file limits for many services with systemd: You create a file at /etc/systemd/system/$service_name.service.d/limits.conf, add a [Service] section with ...
6
votes
2answers
9k views

/etc/security/limits.conf not applied

I have /etc/security/limits.conf, that seems not been applied: a soft nofile 1048576 # default: 1024 a hard nofile 2097152 a soft noproc 262144 # default 128039 a hard noproc 524288 Where a is my ...
1
vote
3answers
3k views

How to kill the processes when no root permission and nproc limit exceeded?

So, a user had exceeded her nproc limit. Due to this, both SSH and su are unable to login as the target user. However, there is no accessible shell which is owned by the user. How can this be solved ...
65
votes
2answers
72k views

How to limit a process to one CPU core in Linux? [duplicate]

How to limit process to one cpu core ? Something similar to ulimit or cpulimit would be nice. (Just to ensure: I do NOT want to limit percentage usage or time of execution. I want to force app (with ...
21
votes
1answer
37k views

sudo: ulimit: command not found [duplicate]

On Ubuntu 12.04, I ran ulimit -n, it is showing 1024. I want to increase my open file limit from 1024 to 65535, so I tried the following command: sudo ulimit -n 65535 but I get the following error: ...