# How does nginx know about FastCGI's stderr?

**URL:** <https://www.ruby-forum.com/t/how-does-nginx-know-about-fastcgis-stderr/185144>\
**Category:** NGINX\
**Created:** [March 15, 2010, 4:16am UTC](https://www.ruby-forum.com/t/how-does-nginx-know-about-fastcgis-stderr/185144 "2010-03-15T04:16:06Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [March 15, 2010, 4:16am UTC](https://www.ruby-forum.com/t/how-does-nginx-know-about-fastcgis-stderr/185144/1 "2010-03-15T04:16:06Z")

</div>

nginx’s error.log says:  
2010/03/15 11:13:15 [error] 10978#0: \*10642 FastCGI sent in stderr:  
"PHP Deprecated: Function ereg() is deprecated in  
/usr/local/cacti/lib/rrd.php on line 734  
PHP Deprecated: Function ereg() is deprecated in  
/usr/local/cacti/lib/rrd.php on line 1020

etc. But I don’t know how nginx knows about FastCGI’s stderr?

–  
Ren Xiaolei

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [March 15, 2010, 10:50am UTC](https://www.ruby-forum.com/t/how-does-nginx-know-about-fastcgis-stderr/185144/2 "2010-03-15T10:50:31Z")

</div>

Hello!

On Mon, Mar 15, 2010 at 11:15:36AM +0800, ä»»æ™“ç£Š wrote:

> nginx’s error.log says:  
> 2010/03/15 11:13:15 [error] 10978#0: \*10642 FastCGI sent in stderr:  
> "PHP Deprecated: Function ereg() is deprecated in  
> /usr/local/cacti/lib/rrd.php on line 734  
> PHP Deprecated: Function ereg() is deprecated in  
> /usr/local/cacti/lib/rrd.php on line 1020
> 
> etc. But I don’t know how nginx knows about FastCGI’s stderr?

[http://www.fastcgi.com/devkit/doc/fcgi-spec.html](http://www.fastcgi.com/devkit/doc/fcgi-spec.html)

Maxim D.

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [March 15, 2010, 1:56pm UTC](https://www.ruby-forum.com/t/how-does-nginx-know-about-fastcgis-stderr/185144/3 "2010-03-15T13:56:40Z")

</div>

On Mon, Mar 15, 2010 at 5:49 PM, Maxim D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> [http://www.fastcgi.com/devkit/doc/fcgi-spec.html](http://www.fastcgi.com/devkit/doc/fcgi-spec.html)  
> Thank you, Maxim. The document above tells me the detail. I thought  
> the protocol is a couple of stdio pipes before read this.

So, could you tell me why I see 502 when something in FastCGI’s  
stderr? Does texts from FastCGI’s stderr lead to 502 ? But the specs  
says they’re just application-level errors.

–  
Ren Xiaolei

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [March 15, 2010, 2:15pm UTC](https://www.ruby-forum.com/t/how-does-nginx-know-about-fastcgis-stderr/185144/4 "2010-03-15T14:15:59Z")

</div>

Hello!

On Mon, Mar 15, 2010 at 08:56:11PM +0800, ä»»æ™“ç£Š wrote:

> On Mon, Mar 15, 2010 at 5:49 PM, Maxim D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > [http://www.fastcgi.com/devkit/doc/fcgi-spec.html](http://www.fastcgi.com/devkit/doc/fcgi-spec.html)  
> > Thank you, Maxim. The document above tells me the detail. I thought  
> > the protocol is a couple of stdio pipes before read this.
> 
> So, could you tell me why I see 502 when something in FastCGI’s  
> stderr? Does texts from FastCGI’s stderr lead to 502 ? But the specs  
> says they’re just application-level errors.

Writing to stderr shouldn’t lead to 502 from nginx. This may  
happen in two cases:

1. Application actually dies (or aborts request) after writing to  
stderr.

2. Bug in nginx. There is one known bug with fastcgi\_cache and  
large stderr from fastcgi apps which may lead to 502 returned  
unexpectedly. It’s mostly fixed in 0.8.34, though fix may lead to  
segfaults in nginx worker when fastcgi\_cache isn’t used, patch is  
here:

> **[nginx 0.8.34 segmentation fault](http://mailman.nginx.org/pipermail/nginx-ru/2010-March/032836.html)**

Maxim D.

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [March 15, 2010, 2:31pm UTC](https://www.ruby-forum.com/t/how-does-nginx-know-about-fastcgis-stderr/185144/5 "2010-03-15T14:31:12Z")

</div>

On Mon, Mar 15, 2010 at 9:15 PM, Maxim D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> 1. Bug in nginx. Â There is one known bug with fastcgi\_cache and  
> large stderr from fastcgi apps which may lead to 502 returned  
> unexpectedly. Â It’s mostly fixed in 0.8.34, though fix may lead to  
> segfaults in nginx worker when fastcgi\_cache isn’t used, patch is  
> here:
> 
> [nginx 0.8.34 segmentation fault](http://nginx.org/pipermail/nginx-ru/2010-March/032836.html)

## Mostly like to be this. OK, I’ll wait for next version in 0.7 series, and try. Sorry to not helping because of my poor programming skill.

Ren Xiaolei
