This topic describes the causes and solutions for process creation failures on an Elastic Compute Service (ECS) instance running Alibaba Cloud Linux 2.
Symptoms
When the fork or clone system call runs on the instance, the error -1 EAGAIN (Resource temporarily unavailable) appears and no new processes can be created. This failure shows up in two ways:
Shell commands fail: Running shell commands produces
bash: fork: retry: No child processes.Application-specific failure: Processes or threads cannot be created for certain applications but work normally for others.
Causes
The EAGAIN error is triggered when any of the following system limits is reached:
| Limit | Description | Diagnostic command |
|---|---|---|
| Per-user thread limit | The maximum number of threads the system user can create is reached. This typically causes shell commands to fail across the board. | ulimit -u |
Application-specific limit (app_limit) | The number of processes (nr_user_process) created by the runtime user for a specific application exceeds that application's upper limit. Only the affected application fails. | — |
Solution 1: Increase the thread limit for the system user
Use this solution when shell commands fail with bash: fork: retry: No child processes.
Step 1: Identify and terminate threads that are consuming excessive resources
Identify which applications are consuming the most threads.
Terminate any application that is occupying an excessive number of threads. Replace
<PID>with the process ID (PID) of the application to terminate.WarningThe
killcommand terminates processes immediately and can cause data loss. Before running it, create a snapshot of the instance or back up critical files.kill -9 <PID>
Step 2: Raise the thread limit
Replace <$Num_Of_Process> with the new limit value.
ulimit -u <$Num_Of_Process>Solution 2: Increase the resource limit for a specific process
Use this solution when only specific applications fail to create processes or threads.
(Optional) If
util-linuxis not installed, install it first.yum install -y util-linuxSet the process limit to unlimited for the target process. Replace
<$PID>with the PID of the process.prlimit --pid <$PID> --nproc=unlimitedThis change takes effect immediately for the running process but does not persist after the process restarts.