MySQL · December 20, 2023

How to Fix MySQL Error - Can't create a new thread (errno 35); if you are not out of available memory, you can consult the manual for a possible OS-dependent bug

How to Fix MySQL Error - Can't create a new thread (errno 35)

MySQL is a popular open-source relational database management system used by many websites and applications. However, like any software, it can encounter errors that can disrupt its normal operation. One such error is the "Can't create a new thread (errno 35)" error. In this article, we will explore the causes of this error and provide solutions to fix it.

Understanding the Error

The "Can't create a new thread (errno 35)" error typically occurs when MySQL tries to create a new thread but fails due to certain limitations or issues. This error message indicates that the system is unable to allocate resources for a new thread, which can be caused by various factors.

Possible Causes

There are several potential causes for this error:

  • Insufficient System Resources: If your server is running low on memory or other system resources, MySQL may not be able to create new threads.
  • Incorrect MySQL Configuration: Improper configuration settings in the MySQL configuration file (my.cnf) can lead to this error.
  • Operating System Limitations: Some operating systems impose limits on the number of threads a process can create, which can cause this error.
  • Bugs or Incompatibilities: In some cases, this error may be caused by bugs or incompatibilities between MySQL and the operating system.

Fixing the Error

Now that we understand the possible causes, let's explore some solutions to fix the "Can't create a new thread (errno 35)" error:

1. Increase System Resources

If the error is due to insufficient system resources, you can try increasing the available resources. This can be done by upgrading your server's hardware, optimizing your application's memory usage, or adjusting the MySQL configuration settings to allocate more memory for threads.

2. Optimize MySQL Configuration

Review your MySQL configuration file (my.cnf) and ensure that the settings are appropriate for your server's resources and workload. Pay attention to parameters such as "max_connections" and "thread_cache_size" that control the number of concurrent connections and thread cache size. Adjust these values based on your server's capabilities.

3. Check Operating System Limits

If the operating system imposes limits on the number of threads, you may need to adjust these limits. Consult your operating system's documentation to understand how to modify these limits. Be cautious when changing system limits, as it can affect the overall performance and stability of your server.

4. Update MySQL and Operating System

If you suspect that the error is caused by bugs or incompatibilities, make sure you are using the latest stable versions of MySQL and your operating system. Check for any available updates or patches that address known issues. Upgrading to newer versions can often resolve compatibility problems.

5. Seek Professional Assistance

If you have tried the above solutions and are still experiencing the error, it may be beneficial to seek assistance from a professional. Consulting with a database administrator or contacting the support team of your VPS hosting provider can help diagnose and resolve the issue.

Summary

The "Can't create a new thread (errno 35)" error in MySQL can be caused by various factors, including insufficient system resources, incorrect configuration, operating system limitations, or bugs/incompatibilities. To fix this error, you can increase system resources, optimize MySQL configuration, adjust operating system limits, update MySQL and the operating system, or seek professional assistance.

If you are looking for reliable VPS hosting solutions, consider Server.HK. With top-notch performance and excellent support, Server.HK offers a range of VPS hosting plans to meet your specific needs.