Re: Browser displays blank page, while request still being handled

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

 



On Mon, May 8, 2006 3:41 am, Rolf Wouters wrote:
> I'm having some strange behaviour in a PHP4 app I'm working on.
>
> When I send my request to the server, it returns a blank page to me
> within ca. 40 sec.  On the server itself, my request is still being
> handled.

It is possible that you are managing to call 'fork' in some manner.

>From your description, you may be firing up shell scripts that fork
within the script.

Even if you have no "fork" in any of that, the OS may not guarantee
that any of the operations you use are atomic, nor even synchronous.

I.e., perhaps "unlink" (for all I know) is queued up by Linux in some
internal stack of operations and the file is still "there" after I
call http://php.net/unlink

While in normal operations one more or less "assumes" that these
operations "just work" you can't rely on assumptions that operations
are atomic and synchronous unless they are documented as such.  Which
means that you may be "stuck" with programming some kind of locking
mechanism yourself to be sure the system is in the state you need it
to be before you do certain portions of your script.

> The script behind the request does the following:
>
> - delete some files
> - copy files from dir A to dir B
> - read some data from a database and generates some XML-files
>
> (i.e. a basic "publish" procedure)
>
> The problem isn't the script itself, nor the server.  I know this,
> because the same code is being used on the same server for other
> instances of this application.

Take this view-point, to keep your sanity:

The script is buggy, always has been buggy, but is only now exhibiting
noticable behaviour of the bug.

Which is painful, but better than the Voodoo of a script that is
"fine" except sometimes it's not.

> The only difference between the problem-app and the other apps is that
> the problem app has:
> A) a lot more files needing to be copied (number of files and size)
> B) a lot more (stale) records in the DB

Do stale files correspond to the files getting deleted?...

If not, this is coming out of left field and you're not telling us
enough :-)

> Another strange thing is, that when I try to view the source code of
> the
> blank page, my browser asks me if I want to send the request again :-(

Check the expiration headers -- If the browser thinks it's out of
date, then it will reload to "View Source", in some browsers.

Also, if the script terminated and Apache sent a non-200 return code,
then the browser "knows" it never got the real page, and may be trying
to help you by getting the true page when you do "View Source"  I
think switching browsers may actually help this somewhat, as they
behave differently in these boundary conditions.

> I've been searching the Web for a long time now, and I'm really
> desperate for some answers.  If anyone could help me, even a hint of
> where to start, it would be greatly appreciated.

Using Firefox, install the plug-in/extension that shows all the
headers you are getting -- At least two of the possible problems above
will become much more clear with HTTP headers in plain view.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
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