152
BashERRORCriticalSignalHIGH confidence

CPU time limit exceeded (SIGXCPU)

Production Risk

Common in HPC/batch environments; investigate runaway loops or optimize CPU-intensive operations.

What this means

Exit code 152 (128+24) indicates the process exceeded the CPU time limit set by ulimit -t or setrlimit(RLIMIT_CPU). The kernel sends SIGXCPU when the soft limit is reached, then SIGKILL at the hard limit.

Why it happens
  1. 1A process ran longer than the CPU time limit set with ulimit -t
  2. 2A runaway loop consuming CPU beyond the allowed budget
  3. 3Batch job systems enforcing per-job CPU limits
How to reproduce

A CPU-intensive process hits the ulimit -t limit.

trigger — this will error
trigger — this will error
#!/bin/bash
# Set a 2-second CPU time limit
(ulimit -t 2; while true; do :; done)
echo "Exit: $?"

expected output

CPU time limit exceeded
Exit: 152

Fix 1

Increase the CPU time limit

WHEN The limit is too low for legitimate workloads

Increase the CPU time limit
# Increase CPU time limit (seconds)
ulimit -t 3600  # 1 hour
your_cpu_intensive_command

Why this works

ulimit -t sets the maximum CPU time in seconds; increase it if the workload is legitimately long.

Fix 2

Optimize the computation or add progress checks

WHEN A loop may be infinite due to a bug

Optimize the computation or add progress checks
#!/bin/bash
count=0
while process_next_item; do
  count=$((count + 1))
  if [ $((count % 1000)) -eq 0 ]; then
    echo "Processed $count items..." >&2
  fi
done

Why this works

Adding progress logging helps diagnose whether the loop is making progress or is stuck.

Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev

← All Bash errors