#57315 closed enhancement (fixed)
Increase HTTP timeout for Theme listing/downloads
Reported by: | ahortin | Owned by: | audrasjb |
---|---|---|---|
Milestone: | 6.2 | Priority: | normal |
Severity: | normal | Version: | 3.0 |
Component: | Themes | Keywords: | commit has-patch |
Focuses: | Cc: |
Description
I just encountered an issue when trying to go to the “Add New” Theme screen in the Dashboard on my local development sites.
An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums.
- I tried different sites with different WP versions, and all had the same issue.
- I tried different browsers. Firefox (my default) and also Brave.
- I tried starting Firefox in Troubleshoot mode (i.e. doesn’t load any browser add-ons)
- I tried disabling my (Bitdefender) Anti-virus.
- There’s no errors showing in the Console or Network tab in the browser Tools, but using the Log HTTP Requests plugin I can see that the API call is returning the following error:
http_request_failed: cURL error 28: Resolving timed out after 5000 milliseconds
If I go to the Add New Plugin screen, it works fine. I was just having having an issue on the Add New Theme screen.
After a number of different suggestions, @dd32 helpfully suggested adding the following filter which did resolve the issue:
add_filter( 'http_request_timeout', function() { return 30; } );
According to @peterwilsoncc, requests to download a Plugin set the timeout to 15 seconds, but Theme downloads do not set a timeout so it's most likely defaulting to 5 seconds.
I'm guessing this is the same for listing themes as well. As mentioned above, I didn't have any issue when listing plugins.
Could the API Timeout for listing (& downloading) Themes, please be increased to 15 seconds, just like the Plugins timeout.
Thanks.
Attachments (1)
Change History (13)
#2
follow-up:
↓ 3
@
2 years ago
Now that WordPress has environment types, it might be worth increasing the intentionally-low timeouts for non-production environments too.
For example, the Plugins and Theme update checks have a ~3-5s default timeout, which could safely be increased to 15s for local/development env's. staging
can probably remain as production values.
#3
in reply to:
↑ 2
@
2 years ago
Replying to dd32:
Now that WordPress has environment types, it might be worth increasing the intentionally-low timeouts for non-production environments too.
For example, the Plugins and Theme update checks have a ~3-5s default timeout, which could safely be increased to 15s for local/development env's.
staging
can probably remain as production values.
Are you thinking for each specific instance interacting with the wp.org API or changing the default in WP_Http::request()
?
This ticket was mentioned in Slack in #core by costdev. View the logs.
22 months ago
#5
follow-up:
↓ 6
@
22 months ago
- Keywords dev-feedback added
This ticket was discussed during the recent bug scrub. Might the proposal in comment:2 be better investigated in a separate ticket, as it targets more than just the Themes timeout?
If so, is there anything else to add to the patch here to resolve this ticket's issue?
Additional props: @SergeyBiryukov
#6
in reply to:
↑ 5
@
22 months ago
- Keywords commit added; dev-feedback removed
- Version changed from 6.1.1 to 3.0
Replying to costdev:
This ticket was discussed during the recent bug scrub. Might the proposal in comment:2 be better investigated in a separate ticket, as it targets more than just the Themes timeout?
A separate ticket makes sense to me. That will allow for this issue to be fixed in the sorter term.
I've changed the version to 3.0.0 as that's when the timeout was extended for plugins to resolve this issue but was missed for themes. See [12742].
This ticket was mentioned in PR #3924 on WordPress/wordpress-develop by @peterwilsoncc.
22 months ago
#7
- Keywords has-patch added
@audrasjb commented on PR #3924:
22 months ago
#8
I restarted the tests as E2E tests were failing.
Looks good to go, it was an unrelated timeout.
#9
@
22 months ago
I manually restarted the tests as E2E tests were failing.
Looks good to go, it was an unrelated timeout, ironically :)
Self assigning for commit
.
@audrasjb commented on PR #3924:
22 months ago
#12
Committed in https://core.trac.wordpress.org/changeset/55188
Thanks for reporting this Anthony.
In 57315.diff I've modified the HTTP request in
themes_api()
to use the same timeout as the HTTP request inplugins_api()
-- fifteen seconds.As consistency between interacting with the themes and plugins APIs is a good thing, I've put this on the 6.2 milestone for consideration.