With the release of WordPress 6.4, some users have reported a bug that’s affecting their WordPress updates and website functionalities due to a cURL timeout error.
What is the cURL Timeout Error in WordPress 6.4?
Some users who have upgraded to WordPress 6.4 are encountering a timeout error:
Error: RuntimeException: Failed to get url 'https://api.wordpress.org/core/version-check/1.7/?locale=en_US': cURL error 28: Operation timed out after 10000 milliseconds with 807 out of -1 bytes received.
The cURL timeout extends its impact to the WordPress Site Health tool, presenting errors that affect the site’s update mechanisms and its ability to communicate through the REST API:
REST API response: (http_request_failed) cURL error 28: Operation timed out after 10005 milliseconds with XXX out of XXX bytes received
This is a cURL error, where ‘cURL’ stands for ‘Client URL’, a library used by WordPress to make requests to other servers. In essence, WordPress is experiencing delays when attempting to communicate with external services, leading to timeouts.
The Broad Impact on Site Operations
More than just an inconvenience, this cURL error has a broad impact on WordPress site operations. It’s been reported to cause issues with WordPress and plugin updates, potentially affecting the REST API, creating problems with payment gateways like the Stripe API, and causing performance issues that could disrupt essential site activities​.
Pinpointing the Cause
The issue has been traced back to a change in how WordPress handles network connections due to an update in the WordPress Requests library, as detailed in this GitHub pull request. The update, meant to optimize connections, instead resulted in connections not being closed when needed, leading to the timeout error.
Implementing an Interim Fix
For those familiar with WordPress’s under-the-hood workings, an interim fix is to modify a line in the core files:
Edit the file at /wp-includes/Requests/src/Transport/Curl.php
.
On line 367
, change:
if ($this->version < self::CURL_7_22_0 && !isset($headers['Connection'])) {
to:
if (!isset($headers['Connection'])) {
This code change prompts WordPress to close connections properly after they’re used, thus preventing the timeout error.
Important Reminder: Always back up your site before making any changes to core files. This fix is temporary and may be replaced in future WordPress updates.
Conclusion
The cURL timeout error in WordPress 6.4 is a technical challenge that requires immediate attention to ensure the smooth running of your website, particularly for updates and payment processing.
While a permanent solution is in the works, the interim solution provided offers a way to mitigate the issue for now.
You can stay updated on developments by monitoring the WordPress Requests GitHub issue and related discussions.
Update: Permanent Fix Now Available
WordPress 6.4.1 Maintenance Release is now available to fix this bug permanently.
If the bug disrupts your WordPress website’s ability to perform updates, you may need to first implement the Interim Fix above before you can update to WordPress 6.4.1.
Alternatively, you can perform a manual update if you’re not confident on making changes to the core file.