dunglas / frankenphp

🧟 The modern PHP app server
https://frankenphp.dev
MIT License
6.87k stars 236 forks source link

cURL error 28: Operation timed out after 10000 milliseconds with 0 bytes received #147

Open manzu opened 1 year ago

manzu commented 1 year ago

Wordpress REST API seems to fail because cURL times out after 10 seconds. I noticed some comments that timeouts are broken because FrankenPHP uses ZTS? (probably for performance reasons? ) I tried editing the Caddyfile main block and adding a timeouts directive in the frankenphp block but it doesn't seem to affect the error.

Can someone point me in a solvable direction?

withinboredom commented 1 year ago

Can you run curl with -vvv and drop the output here? It would help narrow down where it gets stuck at.

manzu commented 1 year ago

well @withinboredom it's a wordpress call around https://github.com/WordPress/WordPress/blob/master/wp-admin/includes/class-wp-site-health.php#L2093

I've tried setting CURLOPT_VERBOSE to true in https://github.com/WordPress/WordPress/blob/master/wp-includes/Requests/src/Transport/Curl.php#L203 but all I get (in the STDERR of the frankenphp container) is:

/app/public# 2023/04/02 20:29:45.674    INFO    http.log.access.log0    handled request {"request": {"remote_ip": "172.17.0.2", "remote_port": "50324", "proto": "HTTP/1.1", "method": "GET", "host": "domain.name", "uri": "/wp-admin/", "headers": {"Accept": ["text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"], "Accept-Language": ["en-GB,en;q=0.9"], "Cookie": [], "X-Forwarded-Host": ["lucianstuparu.ro"], "X-Forwarded-Proto": ["https"], "User-Agent": ["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.3 Safari/605.1.15"], "Accept-Encoding": ["gzip, deflate, br"], "X-Forwarded-For": ["104.28.106.146"]}}, "user_id": "", "duration": 2.586082552, "size": 125049, "status": 200, "resp_headers": {"X-Powered-By": ["PHP/8.2.0"], "Expires": ["Wed, 11 Jan 1984 05:00:00 GMT"], "Cache-Control": ["no-cache, must-revalidate, max-age=0"], "Referrer-Policy": ["strict-origin-when-cross-origin"], "X-Frame-Options": ["SAMEORIGIN"], "Content-Type": ["text/html; charset=UTF-8"], "Server": ["Caddy"]}}
*   Trying ip_address:443...
* Connected to domain.name (ip_address) port 443 (#0)
* ALPN, offering http/1.1
* successfully set certificate verify locations:
*  CAfile: /etc/ssl/certs/ca-certificates.crt
*  CApath: /etc/ssl/certs
* SSL connection using TLSv1.3 / TLS_AES_128_GCM_SHA256
* ALPN, server accepted to use http/1.1
* Server certificate:
*  subject: CN=domain.name
*  start date: Mar 22 15:46:28 2023 GMT
*  expire date: Jun 20 15:46:27 2023 GMT
*  issuer: C=US; O=Let's Encrypt; CN=R3
*  SSL certificate verify ok.
> GET /wp-json/wp/v2/types/post?context=edit HTTP/1.1
Host: domain.name
User-Agent: WordPress/6.2; https://domain.name
Accept: */*
Accept-Encoding: deflate, gzip, br
Cache-Control: no-cache
X-WP-Nonce: 592b45dffe
Cookie: wordpress_sec_e3637abc6a432c3b9a9ebbdc62fee51d=<cookie content>; wordpress_sec_b5aa9253db72164d3a0b6527e8100f22=<cookie content>; tk_ai=jetpack:yW8ZZmGajuaG93yfLi+uotq8; wordpress_logged_in_e3637abc6a432c3b9a9ebbdc62fee51d=<cookie content>; wordpress_test_cookie=WP Cookie check; wp-settings-1=libraryContent=browse&editor=html&hidetb=0; wp-settings-time-1=1679520322; wordpress_logged_in_b5aa9253db72164d3a0b6527e8100f22=<cookie content>
Connection: close

* Operation timed out after 10001 milliseconds with 0 bytes received
* Closing connection 0
withinboredom commented 1 year ago

Hmmm ... looking at the output, it looks like you received headers, so that means we are definitely getting a reply of some sort.

Some experiments to try:

Do any other endpoints work? In other words, could it be that this endpoint takes more than 10s to reply and a timeout is too small somewhere?

dunglas commented 1 year ago

Could it be related to https://github.com/dunglas/frankenphp-wordpress/issues/8?

manzu commented 1 year ago

yes @dunglas it is, but i’m not sure it’s from the wordpress version of frankenphp. that’s why i posted here