upstream sent too big header while reading response header from upstream

前端 未结 8 936
醉梦人生
醉梦人生 2020-11-27 09:33

I am getting these kind of errors:

2014/05/24 11:49:06 [error] 8376#0: *54031 upstream sent too big header while reading response header from upstream

8条回答
  •  南方客
    南方客 (楼主)
    2020-11-27 10:01

    upstream sent too big header while reading response header from upstream is nginx's generic way of saying "I don't like what I'm seeing"

    1. Your upstream server thread crashed
    2. The upstream server sent an invalid header back
    3. The Notice/Warnings sent back from STDERR overflowed their buffer and both it and STDOUT were closed

    3: Look at the error logs above the message, is it streaming with logged lines preceding the message? PHP message: PHP Notice: Undefined index: Example snippet from a loop my log file:

    2015/11/23 10:30:02 [error] 32451#0: *580927 FastCGI sent in stderr: "PHP message: PHP Notice:  Undefined index: Firstname in /srv/www/classes/data_convert.php on line 1090
    PHP message: PHP Notice:  Undefined index: Lastname in /srv/www/classes/data_convert.php on line 1090
    ... // 20 lines of same
    PHP message: PHP Notice:  Undefined index: Firstname in /srv/www/classes/data_convert.php on line 1090
    PHP message: PHP Notice:  Undefined index: Lastname in /srv/www/classes/data_convert.php on line 1090
    PHP message: PHP Notice:  Undef
    2015/11/23 10:30:02 [error] 32451#0: *580927 FastCGI sent in stderr: "ta_convert.php on line 1090
    PHP message: PHP Notice:  Undefined index: Firstname
    

    you can see in the 3rd line from the bottom that the buffer limit was hit, broke, and the next thread wrote in over it. Nginx then closed the connection and returned 502 to the client.

    2: log all the headers sent per request, review them and make sure they conform to standards (nginx does not permit anything older than 24 hours to delete/expire a cookie, sending invalid content length because error messages were buffered before the content counted...). getallheaders function call can usually help out in abstracted code situations php get all headers

    examples include:

    
    

    and this:

    
    
    
    

    1: verify, or make a script log, to ensure your thread is reaching the correct end point and not exiting before completion.

提交回复
热议问题