• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Issue randomly FPM application served by nginx - goes bad?

larryk

Regular Pleskian
Server operating system version
OS: CentOS Linux 7.9.2009 (Core)
Plesk version and microupdate number
Plesk Obsidian Version 18.0.50 Update #2, last updated on Feb 27, 2023 02:02 AM
All I know, when my client tells me they have an "odd" problem, I go and "resave" the PHP setting tab.
OR I might need to toggle the PHP value (pick different one. save. put it back. save)

Has anyone else done this as their "solution" to some strange problem with FPM-PHP?

I really, really wish I knew how to spot or test or know when I need to do this, vs. waiting on my client to tell me they have a problem.
OR it would awesome to prevent this from happening. Less stressful too!

thanks
 
Try to replica the clients issue!
If you can't replica the issue and there are no related errors in the server logs, they must be doing something wrong!
 
You are asking us for a solution to an "odd" problem. That's nearly impossible without knowing some background information:
- What are the symptoms that your users are experiencing?
- It's about a PHP web app, so there must be something in the error_log when it happens. Did you check the error_log when the issue occurs?

So, please give us more info, and we'll gladly help you solve this problem.
 
yeah, it is a tough one...
its hard to explain, but quickly: I have a WP site that has a plugin to create PDFs. Most everything works, but when the "issue" happens, all I know is when FPM-PHP is reset, the problem goes away.

nothing manually happens. The error log gives an incorrect error log... I forget the exact error, but it isn't accurate (other than a problem exist).
I know when I reset the FPM-PHP, the problem goes away.
 
what does restarting it actually do, that could be checked BEFORE restarting it. I'm thinking, if there is a way to see a problem with FPM-PHP, that wold be a better starting point.
 
Without knowing the exact PHP error, I'm going to guess that the problem is in the PDF generation:
"PHP Fatal error: Allowed memory size exhausted."

Again, it's a guess, but this happens when generating pdfs or resizing images with PHP, and there isn't enough memory left.
Increasing memory_limit in the PHP Settings on the domain level is a start to fix this issue.
 
thanks Maarten, but nothing else, zero is done EXCEPT clicking the "apply" button on the PHP Setting page/tab.
OR selecting a different value in the dropdown for "run PHP as", click apply, then switch it back to FPM-PHP value.

So that is my "solution", but the cause... well, yeah, it makes no sense, but when the issues happen. that is my solution.
works. every. time.

FYI: this is an error log I see when trying to create the PDF file when the issue happens, BUT... again... this error is caused by something the ABOVE saving corrects?
because after I click the apply button, this error DOES NOT HAPPEN. all problems disappear until it messed up again :(

49466#0: *5659760 FastCGI sent in stderr: "PHP message: PHP Warning: fopen(): Filename cannot be empty in blabhlbahblah/file.php on line 448" while reading response header from upstream
 
Changing the PHP configuration detaches existing PHP-FPM processes and creates new ones. So if existing process hang, they no longer play a role. The new ones work as expected, for that reason you can then access the website again. The quest is why the website causes PHP-FPM processes to hang. There can be several reasons for it. I'd also say that @Maarten 's suggestion to check RAM consumption is the best shot. It is very likely that processing images or PDFs can cause issues if the overall RAM is exhausted or the max RAM size per script call in PHP is exhausted. Something else very common is that PHP enters an infinite loop, which again causes using more and more RAM until the max is reached and nothing more can be done (this happens very fast, in a fraction of a second). A third possible issue could be that a script is waiting on input that it does not get, e.g. by trying to load data from an URL, but the server does not respond on that URL. It may do so over and over again, which will also cause a process to get stuck or at least make it feel as if it was stuck.
 
THANKS Peter!!!

"The quest is why the website causes PHP-FPM processes to hang"... ahhhhh that could tell me a lot :)

But the oddness of what is working (mostly everything!!!) and the 1 or 2 items I've found that doesn't work... while it is messed up. The needle in the haystack.
Question, is there a "way" to see what is hung up? Any things to check? WOW, that would be a fantastic feature of plesk :)

look here to see all things that are hung up on the server :)


I dont' disagree with increasing the RAM, etc. etc. I've increased a few times over the month...


is there a simple way I can tell, check, test, see IF I need more RAM?

again, how awesome would it be to "just know" by way of seeing stats for every domain on the server... to SEE the details (that matter)... so people like me, who suck at command line, could just view a plesk admin page and know:
- here is your problem, XYZ site needs more RAM
- here is your problem, a PHP SCRIPT is hung up on XYZ site
- here is your problem, the DB is hung due to XYZ site
- or any number of other issues, that are easily detected, if ONLY you knew how to detect the issue :)
 
Changing the PHP configuration detaches existing PHP-FPM processes and creates new ones. So if existing process hang, they no longer play a role. The new ones work as expected, for that reason you can then access the website again. The quest is why the website causes PHP-FPM processes to hang. There can be several reasons for it. I'd also say that @Maarten 's suggestion to check RAM consumption is the best shot. It is very likely that processing images or PDFs can cause issues if the overall RAM is exhausted or the max RAM size per script call in PHP is exhausted. Something else very common is that PHP enters an infinite loop, which again causes using more and more RAM until the max is reached and nothing more can be done (this happens very fast, in a fraction of a second). A third possible issue could be that a script is waiting on input that it does not get, e.g. by trying to load data from an URL, but the server does not respond on that URL. It may do so over and over again, which will also cause a process to get stuck or at least make it feel as if it was stuck.
So thinking, maybe somewhere, the PHP is doing something wrong and memory usage or lack of amount set to use or all in between is an issue? Do you have any ideas on how to find a domain or the script (PHP file) that could be causing the issue? I'm guessing the sites that are causing the issue do have lots of database activity and old code?

Question, does the attached (Memory) chart give you any ideas? :)
thanks!
 

Attachments

  • Screen Shot 2023-07-31 at 11.57.23 AM.png
    Screen Shot 2023-07-31 at 11.57.23 AM.png
    120.3 KB · Views: 3
Back
Top