Re: Re: PHP/Apache: script unexpectedly invoked multiple times in parallel every 30 secs.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Nathan Rixham wrote:
Marc Venturini wrote:
Hi all,

Thank you all very much for your contributions.

I tried to monitor the network with Wireshark: there is only one request
from my browser to the server, and not any answer (redirect or otherwise). This means the problem is definitely not with unexpected browser requests.

Calling die() at the end of the script and removing the redirect did not
change the behavior in any way.

I like to think my code is good, and that the server calls the script in an
unexpected way. The main reason for this belief is that I do not use
multithreading at all, while the logs report the script is running several times in parallel and the network monitor reports a single browser request. I could not find in the docs any server configuration parameter which would
re-invoke a script without killing its currently running instance.


are you forking the script at all? if so you can't unless on the cli


I don't know what is causing it, but is the site live? If so, could it be a proxy somewhere re-requesting the data when it thinks your server has timed out? I guess you ruled that out with the wireshark.

If it really takes over 30 seconds to process the images, would it better to just have your script cue the images and exit, with ImageMagick running on the server to do the actual hard work?

Write a shell script that cron runs every 5 minutes.
The script wgets a shell script from your server with the cue of what needs to be processed and then processes it.

I don't know for sure, but I suspect using ImageMagick in a shell script is going to be less resource intensive than the web server doing it. Doing it that way lets your script exit much sooner and would avoid impatient user reloads, which could be a problem even when you do figure out this issue.

I almost wonder if Apache has some directive that tries to serve the data again if it thinks there was a backend problem with it's first request.

What happens when you try to request your page with wget or lynx?
They won't try to load any images, so if there is a image src problem that should make it obvious.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux