YahnisElsts / wp-update-server

A custom update API for WordPress plugins and themes. Intended to be used in conjunction with my plugin-update-checker library.
MIT License
824 stars 176 forks source link

cURL error 28: timed out #93

Closed janeks closed 3 years ago

janeks commented 3 years ago

One a while customer can't connect to update server (no log entry). Finally I was able to get the error message from Debug > Request info.

[http_request_failed] => Array
                        (
                            [0] => cURL error 28: connect() timed out!
                        )

I understand this is not the Update Server issue or error.

Two questions:

  1. What is the best approach to fix it. What steps can I suggest to customer.
  2. In the above case, clicking Check for updates displays no error. Instead: No updates available. Can we have some other message to indicate the problem?
YahnisElsts commented 3 years ago

What is the best approach to fix it. What steps can I suggest to customer.

Unfortunately, your guess is probably as good as mine. I know relatively little about debugging network connectivity issues. That said, if the problem was reproducible, I would probably start with something like this:

  1. Verify that the update server is actually online.
  2. On the customer's server:
    1. Try to ping the update server, see if the request goes through.
    2. Try to wget the update API URL. If it works on the command line but not in WordPress, that could be a clue.
    3. Run tracert to check for connectivity issues along the way.
    4. If all of the above fail or return an error, nslookup could help diagnose DNS issues.

In the above case, clicking Check for updates displays no error. Instead: No updates available. Can we have some other message to indicate the problem?

It can be done, but it's not convenient. You can use the puc_manual_check_message-$slug filter to change the message that is displayed after checking for updates. However, this filter doesn't get the full request details, just a general status code (e.g. "no_update") as the second argument. You might need to use the puc_request_metadata_http_result-$slug filter to get the HTTP API response, then preserve your custom message somewhere (like a transient) for long enough to display it after the redirect.

janeks commented 3 years ago

Thank you. The ping is simple enough. The other options may be to much for average client. Increasing timeout fro 10 to 30s and disabling other plugins may be also worth trying.