How to Fix “Too Many Open Files” Error and libgcc_s Warning in Siege Load Testing on Linux


4 views

When running high-concurrency load tests with Siege on Linux systems, two common problems emerge:

# Typical error you might encounter
$ siege -c 500 example.com/test.php
[error] descriptor table full sock.c:119: Too many open files
warning: libgcc_s.so.1 must be installed for pthread_cancel to work

Linux systems impose limits on file descriptors to prevent resource exhaustion. Check your current limits with:

# View current limits
ulimit -n
# View system-wide maximum
cat /proc/sys/fs/file-max

For production load testing servers, I recommend setting these values:

# Temporary increase (per session)
ulimit -n 65536

# Permanent solution (add to /etc/security/limits.conf)
* soft nofile 65536
* hard nofile 65536

# System-wide maximum (add to /etc/sysctl.conf)
fs.file-max = 2097152

The warning appears even when libgcc1 is installed because Siege requires specific compatibility libraries. Here's how to fix it:

# For Ubuntu/Debian
sudo apt-get install libgcc1 libgcc2

# For CentOS/RHEL
sudo yum install libgcc

If the warning persists, try explicitly linking the library:

export LD_PRELOAD=/lib/x86_64-linux-gnu/libgcc_s.so.1
siege -c 500 example.com

Beyond fixing errors, optimize your siege configuration for better results:

# ~/.siegerc configuration file
verbose = false
concurrent = 500
time = 1M
delay = 1
benchmark = true

When dealing with persistent issues, check these additional factors:

  • Running strace -f siege [...] to identify system call failures
  • Monitoring /proc/sys/fs/file-nr during tests
  • Checking dmesg for kernel-level errors

Remember that effective load testing requires proper system configuration. These solutions should help you resolve both the file descriptor limits and library warnings, allowing you to run high-concurrency tests effectively.


When running Siege with high concurrency (like -c 500), the system hits two main limitations:

[error] descriptor table full sock.c:119: Too many open files
libgcc_s.so.1 must be installed for pthread_cancel to work

Unix-like systems impose limits on open file descriptors (including network sockets). For stress testing, we need to:

  1. Check current limits: ulimit -n
  2. Check system-wide limits: cat /proc/sys/fs/file-max
  3. Check Siege's actual usage: lsof -p $(pgrep siege) | wc -l

Edit /etc/security/limits.conf:

* soft nofile 65535
* hard nofile 65535
root soft nofile 65535
root hard nofile 65535

Then add to /etc/sysctl.conf:

fs.file-max = 2097152
fs.nr_open = 2097152

Apply changes: sysctl -p and reboot.

Despite having libgcc1 installed, you might need:

sudo apt-get install libgcc1
# For 64-bit systems also:
sudo apt-get install libgcc1:i386

Verify the library path:

ldconfig -p | grep libgcc_s.so.1
# If missing, create symlink manually
sudo ln -s /usr/lib/x86_64-linux-gnu/libgcc_s.so.1 /usr/lib/libgcc_s.so.1

Create ~/.siegerc with these settings:

verbose = false
concurrent = 500
time = 5m
delay = 1
internet = true
benchmark = true
failures = 1000
show-logfile = false
logging = false

If Siege still fails, consider distributed testing:

# Using GNU parallel across multiple servers
parallel -j0 --sshlogin server1,server2,server3 \
"siege -c100 {}" ::: myweb.com/somefile.php

Or use Apache Benchmark with keep-alive:

ab -k -c 500 -n 100000 myweb.com/somefile.php

Watch system metrics in another terminal:

watch -n1 "echo 'Open files:'; lsof | wc -l; echo 'TCP:'; \
ss -s | grep 'estab'; echo 'Memory:'; free -h"