wp cli command returns timeout
-
Sending following command via ssh we get an error
“wp fvm purge”Returns:
“http_request_async curl error: Connection timed out after 1000 milliseconds
Success: FVM and other caches were purged.”We contacted the host (WPE) but couldn’t find a reason for the timeout yet.
Any idea why it happens?
-
The WPE support says it can be related to flush the CDN cache. Because our site doesnt use a CDN.
But I am not sure. Maybe the timeout for the curl is too small? 1s
That message comes from somewhere else, another plugin or your theme, most likely.
After that, you can see: Success: FVM and other caches were purged.That means the command is running, but before that, there is some other code somewhere else, trying to make an external request, that is most likely blocked, either by your host or the api.
It could be a plugin that you lack license for and it’s blocking your server, or it could be a blacklisted domain by your host, or some developer added something to your site to prevent it from connecting to some url (check license for example).
There is also a possibility of being malware, but if the timeout is 1 second, then something is blocking it.
I would suggest, asking your hosting to do a grep on your php files (active theme and plugins only) for any curl function with a 1 second timeout, and then inspect carefully what and why it’s fetching something with a 1 second timeout.
If it’s an async request, a beacon or something like that, just to monitor something, that would make sense to be 1 second.
We don’t use curl on our plugin.
The wp fvm purge command, only runs the 2 default cache purge functions, which doesn’t require an http request.Thanks Raul, I forwarded this to WPE and hope they can find what you suggest to search for. It’s really weird, since we only use this cli command via shell.
So nothing else should run during the cache purging, right?
It doesn’t matter what other commands you run, that curl message will likely show up with any command you input via wp-cli and it’s unrelated to my plugin.
Try to run the cronjobs for example:
wp cron event run --due-nowNope, this is the only output
XXXX.ssh.wpengine.net:~$ wp cron event run --due-now Success: Executed a total of 0 cron events.What does
wp cache flushreturn?Also by WPE, you mean wpengine.com ?
Our cache purge also purges wpengine, so their plugin could be causing it.
This is our code:# Purge WP Engine if (class_exists("WpeCommon")) { if (method_exists('WpeCommon', 'purge_memcached')) { WpeCommon::purge_memcached(); } if (method_exists('WpeCommon', 'clear_maxcdn_cache')) { WpeCommon::clear_maxcdn_cache(); } if (method_exists('WpeCommon', 'purge_varnish_cache')) { WpeCommon::purge_varnish_cache(); } }It checks if their plugin is installed and if it is, it asks their plugin to purge all caches (only if it’s installed).
In that case, it would make sense if they say it’s related to the cdn, as the function tries to purge all caches available.
I haven’t checked if they have a method to verify if the cdn is enabled or not, but if they do, I’ll add it to my plugin.
In that case, while the curl message doesn’t come directly from FVM, it may be related, simply because it runs the cache purge on wpengine plugin, and that plugin returns the error timeout.
I assume, wpengine plugin still makes a curl request to the cdn and that’s why it fails.
I’ll look into it sometime later again.
Returns “Success: The cache was flushed.”
Yes, it means WPengine. I saw the function FVM uses to flush their caches.
I will check if the plugin has some curl calls but still weird that it sends a message back to the cli command. And it hasn’t three weeks ago.Thanks for investigate this “issue”.
If you are comfortable with editing the code, you can comment out the
if (method_exists('WpeCommon', 'clear_maxcdn_cache')) { WpeCommon::clear_maxcdn_cache(); }line on my plugin,functions-cache.phpfile.If running wp-cli again doesn’t return that curl message, then it’s confirmed.
Tried, unfortunately no change to the response.
Then, sorry, but can you try to comment out the other 2 lines?
One of those must be causing it.Boom, I removed the functions call and yes, no error message.
Which one specifically, do you know?
I’m guessing it’s the varnish related one then.
Either way, I will try to look into it later with more time.Remove the complete call, didn’t test one by one. Sorry
You can ignore the error for now, it doesn’t do anything other than to try to purge the cache.
I’ll investigate if wpengine changed something on their plugin soon and push an update.Thanks for reporting.
Thanks for the help, really appreciated!
The topic ‘wp cli command returns timeout’ is closed to new replies.