Bobcares

Curl error: 28 (OPERATION_TIMEOUTED) Fixed!

by | Mar 28, 2019

Website errors are always frustrating. Errors are not at all welcoming especially when you are doing a last minute site update.

One such error is “Curl error: 28 (OPERATION_TIMEOUTED).”

In simple words, this happens when a timeout occurs while performing a curl request in the website. But, it becomes tricky to find the exact reason for timeout.

That’s why, we often get requests from customers to fix Curl errors as part of our Outsourced Technical Support Services.

Today, we’ll see how we helped customer to fix “Curl error: 28 (OPERATION_TIMEOUTED)“.

 

Background of “Curl error: 28”

Firstly, let’s get some details on the exact scenario of the error. In this case, customer approached us with a request saying:

When we automatically post to FB from our subdomains, we get a Curl error: 28 (OPERATION_TIMEOUTED) on some of the subdomains. Can you fix it please?

To understand the error in a better way, our Dedicated Engineers checked his server. We found that he had Nginx web server running on the server. He was using a plugin to directly update Facebook page from his website. Moreover, the problem subdomain was a part of WordPress multi-site.

Additionally, customer was getting a 504 Gateway Time-out error in Nginx  too.

 

Reasons for Curl error: 28 (OPERATION_TIMEOUTED)

Now, its time to see the reasons that can lead to “Curl error: 28 (OPERATION_TIMEOUTED)”.

In simple words, this error is related to the cURL library of the server. Therefore, it can affect any web software using cURL. WordPress websites use cURL library to communicate to other websites. And, when these cURL requests do not complete in a specified time, it ends up in Curl error: 28 (OPERATION_TIMEOUTED).

And, this cURL timeout can occur due to a variety of reasons. Let’s check them in detail now.

 

1. Network/Firewall settings

One of the typical reason for cURL error 28 could be the connection problems due to firewall or network. When there is a firewall between the server and the external website, it can block outgoing request. Similarly, it can happen when the remote server is not reachable due to network errors. Here, the website request keep on trying till the timeout value and eventually time out.

 

2. DNS resolution failures

Yet another reason for “Curl error: 28 (OPERATION_TIMEOUTED)” can be DNS failures. When the domain do not resolve properly, the website will not be reachable from the server. The cURL process wait for sometime to see if the connection succeeds. And, after sometime it times out and show the timeout error.

 

3. Server limits

Again, “Curl error: 28 “ can happen due to limits set in the various services too. In servers, every service has limits set in its own configuration file. For example, web servers like Nginx will have timeout values set in its configuration file.

And, some customers use Nginx as a reverse proxy before Apache server too. Therefore, there will be additional proxy timeout settings too. These timeout values are set in milliseconds. If the cURL request do not complete within these timeout period, it will show cURL errors. In some cases, it will show include the timeout value in milliseconds in the error log.

The other server settings that affect cURL issue include memory limit, timeout settings in PHP, WordPress timeout settings, etc. too.

 

4. Security modules

Occasionally, server security modules like Mod_Security could also block the outgoing cURL requests. Here, the security modules block some website requests assuming them as suspicious. Likewise, some long running process can also result in errors.

 

How we fix Curl error: 28

Till now, we saw the various reasons that can return error from the cURL request from the websites. We’ll now see how our Dedicated Engineers troubleshoot and fix “Curl error: 28 (OPERATION_TIMEOUTED)“.

As the first step of investigation, we check the web server log. This will give us a clue on where exactly is the cURL request failing. We, then check the website link directly. This will help us to rule out the possible problems at the remote server.

If the direct link to the remote website works, that means the problem happens due to server setting. For instance, when the customer had problems updating Facebook page from his subdomain, the Nginx log showed the following entries.

2019/03/21 03:49:12 [error] 31646#0: *6853789 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 66.xx.xx.110, server: xxxx.com, request: "GET / HTTP/1.1", upstream: "http://2xx.1xx.xx.38:7080/", host: "xxxx.com"

Here, the Nginx was failing to connect to Apache to load the website pages. It eventually timed out. And, this was causing the website cURL error in the server. Therefore, to fix the issue, we had to increase the Nginx proxy timeout value, followed by a web server restart.

As these tweaks involve changing the web server configuration, our Support Engineers always make it a point to minimize the impact. This include scheduling web server changes for off peak hours.

Similarly, tweaking the PHP Fast CGI parameters also help to solve curl errors in websites. And, in some cases, to fix, we may have to upgrade the PHP version on the server to the latest too.

[Are you getting Curl error: 28 (OPERATION_TIMEOUTED) in your website? We can fix it for you now.]

 

Conclusion

In short, Curl error: 28 (OPERATION_TIMEOUTED) happens when the curl request from the website takes too much time to complete. Today, we saw the typical reasons for the timeout and how our Support Engineers fix it.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

1 Comment

  1. Md Gulam Rabbi

    good Background of “Curl error: 28”

    Reply

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.