Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > Linux Forums > Server Operation

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 21st October 2010, 23:01
tree8 tree8 is offline
Junior Member
 
Join Date: Oct 2010
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
Exclamation FCGI: ap_pass_brigade failed in handle_request function

Hi.
I'm running a VServer with Debian, Apache 2.2.9, FCGI and SuExec. I'm hosting a website with a pay-for-download service which uses a PHP to deliver files. The code for that is basically (with some checking for valid file/token/etc before):

PHP Code:
header('Content-Description: File Transfer');
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private",false);
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename=\"".basename($filepath)."\";" );
header("Content-Transfer-Encoding: binary");
header("Content-Length: ".filesize($filepath));
ob_clean();
flush();
readfile($filepath); 
This works perfectly fine on one of my computers (Windows 7 x64) and all installed browsers (Chrome/Firefox/Internet Explorer/Opera) but it fails on a different computer (Windows XP SP3) as soon as I try to download bigger files (100-200 MB). The download just stops before 100% are downloaded. The Apache error.log shows entries like

Code:
[Thu Oct 21 02:15:40 2010] [warn] (104)Connection reset by peer: mod_fcgid: read data from fastcgi server error
[Thu Oct 21 02:15:40 2010] [warn] (104)Connection reset by peer: mod_fcgid: ap_pass_brigade failed in handle_request function
So it is obviously related to FCGI. My first idea was to mess around with the fcgid parameters, but that didn't make any changes, so I reset to my previous fcgid settings:
PHP Code:
<IfModule mod_fcgid.c>
  
AddHandler    fcgid-script .php
  AddType       application
/xhttpd-php .php
  IPCConnectTimeout 20
</IfModule
The next thing I tested was to increase the PHP memory limit from 20MB to 256MB, but this didn't change anything either.

Any ideas? I really don't understand why this works on one computer but doesn't work on others. Help is much appreciated!

Thanks
tree8

PS: There are more machines where it doesn't work (and just stops before the 100%), so this cannot be a local problem.
Reply With Quote
Sponsored Links
  #2  
Old 22nd October 2010, 15:39
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,735 Times in 2,571 Posts
Default

Do you use an FCGI wrapper script? If so, can you post it here?
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
  #3  
Old 22nd October 2010, 15:43
tree8 tree8 is offline
Junior Member
 
Join Date: Oct 2010
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by falko View Post
Do you use an FCGI wrapper script? If so, can you post it here?
Yes:

Code:
#!/bin/sh
PHPRC="/home/******/cnf/"
export PHPRC
export TMPDIR=/home/******/tmp
exec /usr/bin/php5-cgi
username replaced by ******
Reply With Quote
  #4  
Old 23rd October 2010, 11:45
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,735 Times in 2,571 Posts
Default

Can you try to add something like this to the wrapper script?

Code:
export PHP_FCGI_MAX_REQUESTS=5000
export PHP_FCGI_CHILDREN=8
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
The Following User Says Thank You to falko For This Useful Post:
tree8 (24th October 2010)
  #5  
Old 23rd October 2010, 16:40
tree8 tree8 is offline
Junior Member
 
Join Date: Oct 2010
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Tested -> it works now! Thanks a lot.

Memory footprint of the server has slightly increased, but nothing to worry.
Only thing I don't understand: Why did this problem occur only on some computers but not on others?

Thx
tree8
Reply With Quote
  #6  
Old 24th October 2010, 13:18
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,735 Times in 2,571 Posts
Default

Quote:
Originally Posted by tree8 View Post
Why did this problem occur only on some computers but not on others?

Thx
tree8
Are all computers identical in hardware (e.g. memory)?
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
  #7  
Old 24th October 2010, 15:21
tree8 tree8 is offline
Junior Member
 
Join Date: Oct 2010
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by falko View Post
Are all computers identical in hardware (e.g. memory)?
Of course not, but I wanted to know how that influences the server's behavior in that case.
Reply With Quote
  #8  
Old 24th October 2010, 20:24
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,735 Times in 2,571 Posts
 
Default

I think that RAM might be a factor.
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
Reply

Bookmarks

Tags
ap_pass_brigade, fcgid

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Failed during pvmove, howto: set up software raid 1 on running LVM system sbh77 HOWTO-Related Questions 2 8th October 2010 00:11
cyrus-sasl won't install on my ubuntu9.04 kameelperdza Installation/Configuration 1 13th June 2009 10:28
Freebsd 6.1 support misterm Installation/Configuration 10 9th April 2009 09:29
Systemimager (rsync) doesn't copy all comedit HOWTO-Related Questions 11 19th January 2007 17:17
How to install BFD (Brute Force Detection) domino Tips/Tricks/Mods 9 31st March 2006 22:40


All times are GMT +2. The time now is 19:40.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.