Edit report at https://bugs.php.net/bug.php?id=65453&edit=1

 ID:                 65453
 Comment by:         sb at crawler-excavators dot com
 Reported by:        oli dot laurel at arcor dot de
 Summary:            Readfile() + mpg = http status 500, windows server
                     2008 r2 sp1, php 5.5.1
 Status:             Feedback
 Type:               Bug
 Package:            IIS related
 Operating System:   Windows Server 2008 R2 SP1
 PHP Version:        5.5.1
 Block user comment: N
 Private report:     N

 New Comment:

hi,
today i installed on a windows server 2008 r2
nginx-1.4.2
and
PHP/5.5.3

and did same test as oli did. Download will NOT be interrupted.
Seems problem only exists in bond with iis and php.
Access log also show only HTTP-Status 200.

C:\nginx>"C:\Program Files (x86)\GnuWin32\bin\wget.exe" --limit-rate=20k --no-ch
eck-certificate --server-response http://127.0.0.1/index.php
SYSTEM_WGETRC = c:/progra~1/wget/etc/wgetrc
syswgetrc = C:\Program Files (x86)\GnuWin32/etc/wgetrc
--2013-09-04 16:28:57--  http://127.0.0.1/index.php
Verbindungsaufbau zu 127.0.0.1:80... verbunden.
HTTP Anforderung gesendet, warte auf Antwort...
  HTTP/1.1 200 OK
  Server: nginx/1.4.2
  Date: Wed, 04 Sep 2013 14:28:57 GMT
  Content-Type: audio/mpeg
  Content-Length: 41598976
  Connection: keep-alive
  X-Powered-By: PHP/5.5.3
  Content-Disposition: inline; filename="movie.mpg"
  X-Pad: avoid browser bug
  Cache-Control: no-cache
Länge: 41598976 (40M) [audio/mpeg]
In »index.php« speichern.

11% [===>                                   ] 4.685.600   20,0K/s  eta 30m 2s


Also with PHP/5.5.2

C:\nginx>"C:\Program Files (x86)\GnuWin32\bin\wget.exe" --limit-rate=20k --no-ch
eck-certificate --server-response http://127.0.0.1/index.php
SYSTEM_WGETRC = c:/progra~1/wget/etc/wgetrc
syswgetrc = C:\Program Files (x86)\GnuWin32/etc/wgetrc
--2013-09-04 16:35:05--  http://127.0.0.1/index.php
Verbindungsaufbau zu 127.0.0.1:80... verbunden.
HTTP Anforderung gesendet, warte auf Antwort...
  HTTP/1.1 200 OK
  Server: nginx/1.4.2
  Date: Wed, 04 Sep 2013 14:35:05 GMT
  Content-Type: audio/mpeg
  Content-Length: 41598976
  Connection: keep-alive
  X-Powered-By: PHP/5.5.2
  Content-Disposition: inline; filename="movie.mpg"
  X-Pad: avoid browser bug
  Cache-Control: no-cache
Länge: 41598976 (40M) [audio/mpeg]
In »index.php« speichern.

11% [===>                                   ] 4.587.296   20,0K/s  eta 30m 7s


Any suggestion for next steps to restrict the problem?


Previous Comments:
------------------------------------------------------------------------
[2013-08-30 11:55:10] oli dot laurel at arcor dot de

thx for reply to all. glad to hear i'm not alone (-:
tested different constellations in the last days.
but didnt find any working constellation.
tried to increase timeout settings in iis but no success.
maybe you figured out something new?

------------------------------------------------------------------------
[2013-08-23 14:06:05] a...@php.net

>From what i could debug now, there is no crash in PHP itself. What happens is 
>that PHP 
exits early but IIS continues to deliver data to client. What I can assume now 
is that 
PHP fills the IIS buffers and waits for taker, but IIS doesn't ask anymore 
because the 
client is downloading with the very low bandwidth and the IIS buffer emties too 
slowly. 
Therefore two possibilities should be checked with IIS

- increasing timeout between PHP and IIS
- increasing internal IIS buffers, so then PHP can fill it up before it's full

Maybe it had really sense to check with IIS specialists anyway. What i'm 
additionally 
going to do now is to check if the same happens on linux with say 
nginx+fastcgi, 
because if it does - that were sure PHP issue.

------------------------------------------------------------------------
[2013-08-22 16:41:20] sb at crawler-excavators dot com

hello,
on 2 of our servers we have same behavior.
we could not narrow down exactly, why script returns error 500 but we also have 
iis + php readfile () in use.
hope you can reproduce & fix the bug soon,... if its really a bug.

regarding webserver crash with multiple downloads we can contribute following:
we have found a setting in iis. in fast-cgi settings, you can limit the "Rapid 
Fails perMinute" by default it is 10.
if you increase it, there will be no error 500 anymore shown to the users.
but in log you still get errors.
it seems that iis kills all php-cgi.exe processes if there are too many fails 
(error 500) in a specific time (perMinute).

------------------------------------------------------------------------
[2013-08-21 08:12:45] a...@php.net

I've just tried with apache and cli server and it's not reproduceable there 
even 
with a smaller bandwidth, so looks like it's stick to IIS. So no need you to do 
it. Still unclear if it's readfile() so going to test your way now.

------------------------------------------------------------------------
[2013-08-20 20:37:01] oli dot laurel at arcor dot de

you can reproduce webserver crash with multiple downloads by following steps:

create file with following content:
[c:\tmp\wget.cmd]
"C:\Program Files (x86)\GnuWin32\bin\wget.exe" --limit-rate=20000 
--server-response http://127.0.0.1/index.php

open cmd and typ in 
cd c:\tmp
for /L %i in (0,1,10) do start wget.cmd %i

loop will start 10 cmd boxes and download the "movie.txt".
wait 10-20 seconds and interrupt download by closing all cmd windows (Close all 
windows)
wait 1-2 seconds and start again 10 multiple downloads 

open cmd typ in 
cd c:\tmp
for /L %i in (0,1,10) do start wget.cmd %i

now all request will be answered with Status 500

c:\tmp>"C:\Program Files (x86)\GnuWin32\bin\wget.exe" --limit-rate=20000 --serve
r-response http://127.0.0.1/index.php
SYSTEM_WGETRC = c:/progra~1/wget/etc/wgetrc
syswgetrc = C:\Program Files (x86)\GnuWin32/etc/wgetrc
--2013-08-20 20:12:16--  http://127.0.0.1/index.php
Verbindungsaufbau zu 127.0.0.1:80... verbunden.
HTTP Anforderung gesendet, warte auf Antwort...
  HTTP/1.1 500 Internal Server Error
  Cache-Control: private
  Content-Type: text/html; charset=utf-8
  Server: Microsoft-IIS/8.0
  Date: Tue, 20 Aug 2013 18:12:16 GMT
  Connection: keep-alive
  Content-Length: 5666
2013-08-20 20:12:16 FEHLER 500: Internal Server Error.



i will try it with apache & cli later because i'm not familiar with this "tools"

regards oli

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=65453


-- 
Edit this bug report at https://bugs.php.net/bug.php?id=65453&edit=1

Reply via email to