LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   3 identical Raspberry Pis, same disk image, yet PHP one one (different location) takes forever to load. Ideas on how to identify the issue? (https://www.linuxquestions.org/questions/linux-newbie-8/3-identical-raspberry-pis-same-disk-image-yet-php-one-one-different-location-takes-forever-to-load-ideas-on-how-to-identify-the-issue-4175685953/)

ziphem 11-28-2020 02:54 PM

3 identical Raspberry Pis, same disk image, yet PHP one one (different location) takes forever to load. Ideas on how to identify the issue?
 
This is a weird situation.

I have 3 Raspberry Pis. All 3 are identical hardware, and all run the same disk image. Each are in different physical locations (different LANs and WANs). These Pis serve as web servers for security cameras, and run php to serve up the files.

In two of the locations, everything works perfectly. In one of the locations, everything works except that the PHP script to display images on my browser takes >1 minute to load (not a trickle, but as in, delay to load).

I've compared the output of

<?php
phpinfo();
?>

from all three Pis, and they are the exact same. In the location where the PHP takes forever to load, I've changed routers, too (general upgrade) and this hasn't worked. Finally, the logs don't seem to indicate any problems.

It feels like some waiting / timeout issue, but I can't think of what it could be. I've tried local (192.168) and remote access test, and same result. Since posting this, I've tried other (basic) PHP scripts and they work without delay. So it's a problem with the code, perhaps trying to read something? Any ideas on good first steps to troubleshoot the issue?

Thanks a ton!!

berndbausch 11-28-2020 05:39 PM

Print the current time at useful locations in the code.

michaelk 11-29-2020 03:10 AM

Is your php code accessing information from other network devices or just from itself? Is running the phpinfo script also slow?

Is the misbehaving pi connected by wifi or ethernet? Is it a bandwidth problem? Have you checked lan bandwidth speed? If accessing other devices are you using DNS or IP address.

ziphem 11-29-2020 04:40 PM

Quote:

Originally Posted by michaelk (Post 6189863)
Is your php code accessing information from other network devices or just from itself? Is running the phpinfo script also slow?

Is the misbehaving pi connected by wifi or ethernet? Is it a bandwidth problem? Have you checked lan bandwidth speed? If accessing other devices are you using DNS or IP address.

YES!!!!!!!!!!!!!!!!! It was calling an old Yahoo weather API (doesn't work anymore), and for whatever reason, the script seems to have hung on that. Remove it and presto, immediate load. Thanks for that idea.

Now I need to figure out why one of the cameras isn't uploading anything to the Pi and there are no errors at all in the vsftp log (even with verbose logging)...

Thanks!

computersavvy 11-29-2020 05:16 PM

Quote:

Originally Posted by ziphem (Post 6190038)
YES!!!!!!!!!!!!!!!!! It was calling an old Yahoo weather API (doesn't work anymore), and for whatever reason, the script seems to have hung on that. Remove it and presto, immediate load. Thanks for that idea.

Now I need to figure out why one of the cameras isn't uploading anything to the Pi and there are no errors at all in the vsftp log (even with verbose logging)...

Thanks!

So you are saying there actually are differences in the scripts. It might be worth deeper investigation as to how the camera is configured as well as the script on the pi.

ziphem 11-29-2020 08:51 PM

Quote:

Originally Posted by computersavvy (Post 6190045)
So you are saying there actually are differences in the scripts. It might be worth deeper investigation as to how the camera is configured as well as the script on the pi.

Interestingly the scripts are the exact same, since I have an SD card image and write that to any new Pi SD card I use. You have a great point that I should dig into this further. I decided to query the URL in question, https://query.yahooapis.com, trying a simple "wget https://query.yahooapis.com". From the Pis where I haven't had any loading issues, I get an immediate response,

Code:

wget https://query.yahooapis.com/
--2020-11-29 21:40:19--  https://query.yahooapis.com/
Resolving query.yahooapis.com (query.yahooapis.com)... failed: No address associated with hostname.
wget: unable to resolve host address ‘query.yahooapis.com’

But from the bad Pi, I get:

Code:

wget https://query.yahooapis.com/
--2020-11-29 21:40:32--  https://query.yahooapis.com/
Resolving query.yahooapis.com (query.yahooapis.com)... 92.242.140.21
Connecting to query.yahooapis.com (query.yahooapis.com)|92.242.140.21|:443... failed: Connection timed out.
Retrying.

--2020-11-29 21:42:43--  (try: 2)  https://query.yahooapis.com/
Connecting to query.yahooapis.com (query.yahooapis.com)|92.242.140.21|:443... failed: Connection timed out.
Retrying.

--2020-11-29 21:44:57--  (try: 3)  https://query.yahooapis.com/
Connecting to query.yahooapis.com (query.yahooapis.com)|92.242.140.21|:443...

As mentioned, these are the same exact SD card images, so what do you think could be the reason for this difference?

michaelk 11-29-2020 09:21 PM

The good Pis
Quote:

Resolving query.yahooapis.com (query.yahooapis.com)... failed: No address associated with hostname.
The bad Pi
Quote:

Connecting to query.yahooapis.com (query.yahooapis.com)|92.242.140.21|:443... failed: Connection timed out.
Looks like a DNS problem. Are you using the ISPs DNS servers via DHCP?


All times are GMT -5. The time now is 05:08 PM.