linux unable to create new native thread
时间: 2023-09-08 14:10:16 浏览: 109
The error message "unable to create new native thread" in Linux usually occurs when the operating system has reached its maximum limit for creating new threads. This limit is set by the `ulimit` command or configured in the `/etc/security/limits.conf` file.
To resolve this issue, you can try the following steps:
1. Check the current limit: Run the `ulimit -u` command to check the maximum number of user processes allowed per user. The maximum number of threads is typically a fraction of this value.
2. Increase the limit: If the current limit is too low, you can increase it temporarily using the `ulimit -u <new_limit>` command, where `<new_limit>` is a higher value than the current limit. Note that you may need root privileges to set a higher limit.
3. Modify system configuration (permanent change): To permanently increase the limit for all users, you can modify the `/etc/security/limits.conf` file. Add or modify the following lines:
```
* soft nproc <new_limit>
* hard nproc <new_limit>
```
Replace `<new_limit>` with the desired maximum number of threads.
4. Restart the system or session: After modifying the system configuration, you may need to restart the system or re-login to apply the changes.
Keep in mind that increasing the thread limit may have an impact on system resources, so it is important to monitor the system's performance after making these changes.
阅读全文