-
Notifications
You must be signed in to change notification settings - Fork 332
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wordpress is unable to perform loopback requests #1041
Comments
@javorszky I know you've been poking at WordPress on Unit recently... in your test deployments do the health checks in the WordPress dashboard all work? @lillian-b Are you able to share your Unit configuration, and how you're installing / running Unit? |
I installed Unit via packages on Rocky Linux, and it's just running via systemd. |
Thanks for this @lillian-b! I can confirm that the some of the site health pingbacks do not work, while others do. I'm trying to figure out what the cause of them are. Also thanks for the config.json file. I'll let you know once I have a solid understanding of why those few are failing 🤔 |
Hi @lillian-b , Good news! Figured out why that's happening and how to fix it! Background: Unit out of the box with default configuration will have a single running process for php applications, which means it can only ever handle one request. In the loopback case there's one going to admin-ajax about kicking off the loopback test, and that loopback test sends another POST request to wp-cron, and waits for that to finish. The problem here is that the loopback POST request can't be handled because the single php process is already handling the one that initiated that one, so it arrives at a deadlock. Other runtimes (apache, nginx (the proxy), php itself) have different number of default processes which prevents deadlocks like this. Essentially this one check overloaded the configuration of a single process. Fix itThankfully the fix only needs a change in your unit config file: "applications": {
"wordpress": {
"type": "php",
"targets": {
"direct": {
"root": "/app/wordpress/"
},
"index": {
"root": "/app/wordpress/",
"script": "index.php"
}
},
"processes": {
"idle_timeout": 30,
"max": 50,
"spare": 1
}
}
}
I've added the You can also configure a set number of processes that would always be kept around. In that case the above configuration would look like this: "applications": {
"wordpress": {
"type": "php",
"targets": {
"direct": {
"root": "/app/wordpress/"
},
"index": {
"root": "/app/wordpress/",
"script": "index.php"
}
},
"processes": 50
}
}
You can read more about these here: https://unit.nginx.org/configuration/#application-processes. Let me know how this goes! |
That worked, thank you so much! |
Oh, that was a typo on my end, so sorry about that! Glad it's working 🙂 |
I run a wordpress server under Unit, and the site health check does not seem to be able to connect back to itself.
However, if I
su
to theunit
user and try to curl that same endpoint, it works:So there is something inside the Unit/PHP process that causes this issue.
How can I debug this?
I cannot find any logs related to this issue (I do see other logs from Unit and Wordpress).
The text was updated successfully, but these errors were encountered: