File size limit exceeded (SIGXFSZ)
Production Risk
Common in environments with strict ulimits; implement log rotation and file size checks.
Exit code 153 (128+25) indicates that a process tried to write a file larger than the limit set by ulimit -f. The kernel sends SIGXFSZ when the file size soft limit is exceeded.
- 1Writing a file that exceeds ulimit -f (file size limit)
- 2A log file grows beyond the per-process file size limit
- 3Creating a large temporary file in a restricted environment
Writing beyond the file size limit.
#!/bin/bash # Set a 1KB file size limit (in 512-byte blocks) (ulimit -f 2; dd if=/dev/zero of=/tmp/bigfile bs=1024 count=10) echo "Exit: $?"
expected output
File size limit exceeded Exit: 153
Fix 1
Increase the file size limit
WHEN The limit is too restrictive for legitimate use
# Increase to 1GB (in 512-byte blocks) ulimit -f $((1024 * 1024 * 2)) # 2M blocks = 1GB your_command
Why this works
ulimit -f is in 512-byte blocks; multiply target size in bytes by 2 to get the block count.
Fix 2
Use log rotation to avoid unbounded file growth
WHEN A service generates large log files
# Use logrotate for managed log rotation
# /etc/logrotate.d/myapp:
/var/log/myapp.log {
daily
rotate 7
compress
maxsize 100M
}Why this works
logrotate prevents any single log file from growing beyond maxsize.
GNU Bash Manual — ulimit
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev