Nginx + php-fpm - recv() errorNginx + PHP-FPM = “Random” 502 Bad GatewayBlank Page: wordpress on nginx+php-fpmNginx load balance with dedicated php-fpm serverphp-fpm, nginx magento store. Coming to a haltnginx returning error 502 when get not exist key on memcachedatomic deployments with Nginx and PHP FPM504 Gateway timeout / 502 Bad gateway after installing php curl - server nginxGetting a 502 Bad gateway error with nginx on ubuntuGetting recv() failed (104: Connection reset by peer)logrotate causes php5-fpm downtime

Displaying an Estimated Execution Plan generates CXPACKET, PAGELATCH_SH, and LATCH_EX [ACCESS_METHODS_DATASET_PARENT] waits

Why can’t you see at the start of the Big Bang?

How is it believable that Euron could so easily pull off this ambush?

Explaining intravenous drug abuse to a small child

Can a player choose to add detail and flavor to their character's spells and abilities?

Why was Gemini VIII terminated after recovering from the OAMS thruster failure?

Was there a dinosaur-counter in the original Jurassic Park movie?

The unknown and unexplained in science fiction

Where do 5 or more U.S. counties meet in a single point?

What detail can Hubble see on Mars?

How can I finally understand the confusing modal verb "мочь"?

How to make a kid's bike easier to pedal

How to increase speed on my hybrid bike with flat handlebars and 700X35C tyres?

My C Drive is full without reason

Why did Dr. Strange keep looking into the future after the snap?

Convert Numbers To Emoji Math

LiOH hydrolysis of methyl 2,2-dimethoxyacetate not giving product?

What calendar would the Saturn nation use?

Good introductory book to type theory?

HTML folder located within IOS Image file?

Would a legitimized Baratheon have the best claim for the Iron Throne?

Why is the blank symbol not considered part of the input alphabet of a Turing machine?

What is more safe for browsing the web: PC or smartphone?

While drilling into kitchen wall, hit a wire - any advice?



Nginx + php-fpm - recv() error


Nginx + PHP-FPM = “Random” 502 Bad GatewayBlank Page: wordpress on nginx+php-fpmNginx load balance with dedicated php-fpm serverphp-fpm, nginx magento store. Coming to a haltnginx returning error 502 when get not exist key on memcachedatomic deployments with Nginx and PHP FPM504 Gateway timeout / 502 Bad gateway after installing php curl - server nginxGetting a 502 Bad gateway error with nginx on ubuntuGetting recv() failed (104: Connection reset by peer)logrotate causes php5-fpm downtime






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








1















I get the follow error in the nginx log




[error] 17734#0: *6643 recv() failed (104: Connection reset by peer)
while reading response header from upstream, client: [cut],
server: [cut], request: "GET /venues HTTP/1.1", upstream:
"fastcgi://127.0.0.1:9000", host: "[cut]"




I have a dedicated box with 8 gb ram, quad core chip. Good server.
Nginx, php-fpm & mysql all latest versions running under ubuntu 10.04



I only get this when I stress test the server with siege. If I increase the number of concurrent connections to 100, I can get up to 20% of all requests to fail.



Furthermore, I don't get this on pages that have no mysql queries. And only a few failures on pages with moderate number of queries. Bit, I'm not sure if that's got to do anything with it.



I have a feeling this is something to do with php. But I can't figure it out.



Any suggestions of where to even start looking?



Update: and the php error log is silent. No record of anything going wrong










share|improve this question






















  • I've seen many of these threads pop up in the php-highload-en group. One guys problem was hitting the mysql connection limit durring siege . Most of the time they recommend profiling the application and its sql queries. You could try posting there: groups.google.com/group/highload-php-en

    – iainlbc
    Aug 18 '11 at 23:24











  • What about the nginx error log? And the MySQL normal log as well as the slow query log? Is query caching in play at all? What is the nginx.conf like? What is the php config like?

    – JayMcTee
    Nov 11 '15 at 9:23

















1















I get the follow error in the nginx log




[error] 17734#0: *6643 recv() failed (104: Connection reset by peer)
while reading response header from upstream, client: [cut],
server: [cut], request: "GET /venues HTTP/1.1", upstream:
"fastcgi://127.0.0.1:9000", host: "[cut]"




I have a dedicated box with 8 gb ram, quad core chip. Good server.
Nginx, php-fpm & mysql all latest versions running under ubuntu 10.04



I only get this when I stress test the server with siege. If I increase the number of concurrent connections to 100, I can get up to 20% of all requests to fail.



Furthermore, I don't get this on pages that have no mysql queries. And only a few failures on pages with moderate number of queries. Bit, I'm not sure if that's got to do anything with it.



I have a feeling this is something to do with php. But I can't figure it out.



Any suggestions of where to even start looking?



Update: and the php error log is silent. No record of anything going wrong










share|improve this question






















  • I've seen many of these threads pop up in the php-highload-en group. One guys problem was hitting the mysql connection limit durring siege . Most of the time they recommend profiling the application and its sql queries. You could try posting there: groups.google.com/group/highload-php-en

    – iainlbc
    Aug 18 '11 at 23:24











  • What about the nginx error log? And the MySQL normal log as well as the slow query log? Is query caching in play at all? What is the nginx.conf like? What is the php config like?

    – JayMcTee
    Nov 11 '15 at 9:23













1












1








1








I get the follow error in the nginx log




[error] 17734#0: *6643 recv() failed (104: Connection reset by peer)
while reading response header from upstream, client: [cut],
server: [cut], request: "GET /venues HTTP/1.1", upstream:
"fastcgi://127.0.0.1:9000", host: "[cut]"




I have a dedicated box with 8 gb ram, quad core chip. Good server.
Nginx, php-fpm & mysql all latest versions running under ubuntu 10.04



I only get this when I stress test the server with siege. If I increase the number of concurrent connections to 100, I can get up to 20% of all requests to fail.



Furthermore, I don't get this on pages that have no mysql queries. And only a few failures on pages with moderate number of queries. Bit, I'm not sure if that's got to do anything with it.



I have a feeling this is something to do with php. But I can't figure it out.



Any suggestions of where to even start looking?



Update: and the php error log is silent. No record of anything going wrong










share|improve this question














I get the follow error in the nginx log




[error] 17734#0: *6643 recv() failed (104: Connection reset by peer)
while reading response header from upstream, client: [cut],
server: [cut], request: "GET /venues HTTP/1.1", upstream:
"fastcgi://127.0.0.1:9000", host: "[cut]"




I have a dedicated box with 8 gb ram, quad core chip. Good server.
Nginx, php-fpm & mysql all latest versions running under ubuntu 10.04



I only get this when I stress test the server with siege. If I increase the number of concurrent connections to 100, I can get up to 20% of all requests to fail.



Furthermore, I don't get this on pages that have no mysql queries. And only a few failures on pages with moderate number of queries. Bit, I'm not sure if that's got to do anything with it.



I have a feeling this is something to do with php. But I can't figure it out.



Any suggestions of where to even start looking?



Update: and the php error log is silent. No record of anything going wrong







nginx php-fpm mysql5






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Aug 18 '11 at 22:43









Ilya BiryukovIlya Biryukov

13336




13336












  • I've seen many of these threads pop up in the php-highload-en group. One guys problem was hitting the mysql connection limit durring siege . Most of the time they recommend profiling the application and its sql queries. You could try posting there: groups.google.com/group/highload-php-en

    – iainlbc
    Aug 18 '11 at 23:24











  • What about the nginx error log? And the MySQL normal log as well as the slow query log? Is query caching in play at all? What is the nginx.conf like? What is the php config like?

    – JayMcTee
    Nov 11 '15 at 9:23

















  • I've seen many of these threads pop up in the php-highload-en group. One guys problem was hitting the mysql connection limit durring siege . Most of the time they recommend profiling the application and its sql queries. You could try posting there: groups.google.com/group/highload-php-en

    – iainlbc
    Aug 18 '11 at 23:24











  • What about the nginx error log? And the MySQL normal log as well as the slow query log? Is query caching in play at all? What is the nginx.conf like? What is the php config like?

    – JayMcTee
    Nov 11 '15 at 9:23
















I've seen many of these threads pop up in the php-highload-en group. One guys problem was hitting the mysql connection limit durring siege . Most of the time they recommend profiling the application and its sql queries. You could try posting there: groups.google.com/group/highload-php-en

– iainlbc
Aug 18 '11 at 23:24





I've seen many of these threads pop up in the php-highload-en group. One guys problem was hitting the mysql connection limit durring siege . Most of the time they recommend profiling the application and its sql queries. You could try posting there: groups.google.com/group/highload-php-en

– iainlbc
Aug 18 '11 at 23:24













What about the nginx error log? And the MySQL normal log as well as the slow query log? Is query caching in play at all? What is the nginx.conf like? What is the php config like?

– JayMcTee
Nov 11 '15 at 9:23





What about the nginx error log? And the MySQL normal log as well as the slow query log? Is query caching in play at all? What is the nginx.conf like? What is the php config like?

– JayMcTee
Nov 11 '15 at 9:23










2 Answers
2






active

oldest

votes


















0














Most probably you ran out of php-fpm workers. The log was silent because nothing was wrong in the code itself - workers just were busy processing your requests. If you did not get this on pages without MySQL queries, the bottleneck was the MySQL DB. You should identify long-running queries (using mytop or slow log feature or maybe some custom PHP logging around your SQL processing) and optimize them. Of course, "long queries" are actually quite short in high-load we world. Even 200ms query is long enough to put your server on its knees.






share|improve this answer























  • Does php-fpm seriously just silently drop connections when it's pool is fully occupied? That's horrendous.

    – womble
    Aug 18 '11 at 23:08











  • @womble When load comes in peaks it depends on a TCP backlog size I guess, but when load is constantly high the backlog will end sooner or later, so this behavior is quite predictable.

    – Alex
    Aug 18 '11 at 23:14






  • 1





    Sure, sometimes you can't handle something, and dropping a connection is possibly the best option. It's the silence I can't fathom. If you're going to do something out of the ordinary, you have to log it. No exceptions.

    – womble
    Aug 18 '11 at 23:42


















-1














this may be resolved. i reported a similar issue with opening and reusing persistent tcp sockets under almost no load at all. there's now a patch landed for this in git:



https://groups.google.com/forum/#!topic/highload-php-en/qGu3Eaifj9s






share|improve this answer























    Your Answer








    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "2"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f302822%2fnginx-php-fpm-recv-error%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    Most probably you ran out of php-fpm workers. The log was silent because nothing was wrong in the code itself - workers just were busy processing your requests. If you did not get this on pages without MySQL queries, the bottleneck was the MySQL DB. You should identify long-running queries (using mytop or slow log feature or maybe some custom PHP logging around your SQL processing) and optimize them. Of course, "long queries" are actually quite short in high-load we world. Even 200ms query is long enough to put your server on its knees.






    share|improve this answer























    • Does php-fpm seriously just silently drop connections when it's pool is fully occupied? That's horrendous.

      – womble
      Aug 18 '11 at 23:08











    • @womble When load comes in peaks it depends on a TCP backlog size I guess, but when load is constantly high the backlog will end sooner or later, so this behavior is quite predictable.

      – Alex
      Aug 18 '11 at 23:14






    • 1





      Sure, sometimes you can't handle something, and dropping a connection is possibly the best option. It's the silence I can't fathom. If you're going to do something out of the ordinary, you have to log it. No exceptions.

      – womble
      Aug 18 '11 at 23:42















    0














    Most probably you ran out of php-fpm workers. The log was silent because nothing was wrong in the code itself - workers just were busy processing your requests. If you did not get this on pages without MySQL queries, the bottleneck was the MySQL DB. You should identify long-running queries (using mytop or slow log feature or maybe some custom PHP logging around your SQL processing) and optimize them. Of course, "long queries" are actually quite short in high-load we world. Even 200ms query is long enough to put your server on its knees.






    share|improve this answer























    • Does php-fpm seriously just silently drop connections when it's pool is fully occupied? That's horrendous.

      – womble
      Aug 18 '11 at 23:08











    • @womble When load comes in peaks it depends on a TCP backlog size I guess, but when load is constantly high the backlog will end sooner or later, so this behavior is quite predictable.

      – Alex
      Aug 18 '11 at 23:14






    • 1





      Sure, sometimes you can't handle something, and dropping a connection is possibly the best option. It's the silence I can't fathom. If you're going to do something out of the ordinary, you have to log it. No exceptions.

      – womble
      Aug 18 '11 at 23:42













    0












    0








    0







    Most probably you ran out of php-fpm workers. The log was silent because nothing was wrong in the code itself - workers just were busy processing your requests. If you did not get this on pages without MySQL queries, the bottleneck was the MySQL DB. You should identify long-running queries (using mytop or slow log feature or maybe some custom PHP logging around your SQL processing) and optimize them. Of course, "long queries" are actually quite short in high-load we world. Even 200ms query is long enough to put your server on its knees.






    share|improve this answer













    Most probably you ran out of php-fpm workers. The log was silent because nothing was wrong in the code itself - workers just were busy processing your requests. If you did not get this on pages without MySQL queries, the bottleneck was the MySQL DB. You should identify long-running queries (using mytop or slow log feature or maybe some custom PHP logging around your SQL processing) and optimize them. Of course, "long queries" are actually quite short in high-load we world. Even 200ms query is long enough to put your server on its knees.







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Aug 18 '11 at 23:06









    AlexAlex

    6,63132846




    6,63132846












    • Does php-fpm seriously just silently drop connections when it's pool is fully occupied? That's horrendous.

      – womble
      Aug 18 '11 at 23:08











    • @womble When load comes in peaks it depends on a TCP backlog size I guess, but when load is constantly high the backlog will end sooner or later, so this behavior is quite predictable.

      – Alex
      Aug 18 '11 at 23:14






    • 1





      Sure, sometimes you can't handle something, and dropping a connection is possibly the best option. It's the silence I can't fathom. If you're going to do something out of the ordinary, you have to log it. No exceptions.

      – womble
      Aug 18 '11 at 23:42

















    • Does php-fpm seriously just silently drop connections when it's pool is fully occupied? That's horrendous.

      – womble
      Aug 18 '11 at 23:08











    • @womble When load comes in peaks it depends on a TCP backlog size I guess, but when load is constantly high the backlog will end sooner or later, so this behavior is quite predictable.

      – Alex
      Aug 18 '11 at 23:14






    • 1





      Sure, sometimes you can't handle something, and dropping a connection is possibly the best option. It's the silence I can't fathom. If you're going to do something out of the ordinary, you have to log it. No exceptions.

      – womble
      Aug 18 '11 at 23:42
















    Does php-fpm seriously just silently drop connections when it's pool is fully occupied? That's horrendous.

    – womble
    Aug 18 '11 at 23:08





    Does php-fpm seriously just silently drop connections when it's pool is fully occupied? That's horrendous.

    – womble
    Aug 18 '11 at 23:08













    @womble When load comes in peaks it depends on a TCP backlog size I guess, but when load is constantly high the backlog will end sooner or later, so this behavior is quite predictable.

    – Alex
    Aug 18 '11 at 23:14





    @womble When load comes in peaks it depends on a TCP backlog size I guess, but when load is constantly high the backlog will end sooner or later, so this behavior is quite predictable.

    – Alex
    Aug 18 '11 at 23:14




    1




    1





    Sure, sometimes you can't handle something, and dropping a connection is possibly the best option. It's the silence I can't fathom. If you're going to do something out of the ordinary, you have to log it. No exceptions.

    – womble
    Aug 18 '11 at 23:42





    Sure, sometimes you can't handle something, and dropping a connection is possibly the best option. It's the silence I can't fathom. If you're going to do something out of the ordinary, you have to log it. No exceptions.

    – womble
    Aug 18 '11 at 23:42













    -1














    this may be resolved. i reported a similar issue with opening and reusing persistent tcp sockets under almost no load at all. there's now a patch landed for this in git:



    https://groups.google.com/forum/#!topic/highload-php-en/qGu3Eaifj9s






    share|improve this answer



























      -1














      this may be resolved. i reported a similar issue with opening and reusing persistent tcp sockets under almost no load at all. there's now a patch landed for this in git:



      https://groups.google.com/forum/#!topic/highload-php-en/qGu3Eaifj9s






      share|improve this answer

























        -1












        -1








        -1







        this may be resolved. i reported a similar issue with opening and reusing persistent tcp sockets under almost no load at all. there's now a patch landed for this in git:



        https://groups.google.com/forum/#!topic/highload-php-en/qGu3Eaifj9s






        share|improve this answer













        this may be resolved. i reported a similar issue with opening and reusing persistent tcp sockets under almost no load at all. there's now a patch landed for this in git:



        https://groups.google.com/forum/#!topic/highload-php-en/qGu3Eaifj9s







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Oct 21 '13 at 21:47









        leeoniyaleeoniya

        1175




        1175



























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Server Fault!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f302822%2fnginx-php-fpm-recv-error%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            How to write a 12-bar blues melodyI-IV-V blues progressionHow to play the bridges in a standard blues progressionHow does Gdim7 fit in C# minor?question on a certain chord progressionMusicology of Melody12 bar blues, spread rhythm: alternative to 6th chord to avoid finger stretchChord progressions/ Root key/ MelodiesHow to put chords (POP-EDM) under a given lead vocal melody (starting from a good knowledge in music theory)Are there “rules” for improvising with the minor pentatonic scale over 12-bar shuffle?Confusion about blues scale and chords

            What if the end-user didn't have the required library?What is setup.py?What is a clean, pythonic way to have multiple constructors in Python?What does Ruby have that Python doesn't, and vice versa?What is the reason for having '//' in Python?How do I create a namespace package in Python?How to package shared objects that python modules depend on?setuptools vs. distutils: why is distutils still a thing?Navigation in Windows 10 vs code not going to virtualenv library when the same library is installed at user levelPython create package for local usePackaging a project that uses multiple python versionsWhy is permission denied on pip install except for when “--user” is included at end of command?

            Esgonzo ibérico Índice Descrición Distribución Hábitat Ameazas Notas Véxase tamén "Acerca dos nomes dos anfibios e réptiles galegos""Chalcides bedriagai"Chalcides bedriagai en Carrascal, L. M. Salvador, A. (Eds). Enciclopedia virtual de los vertebrados españoles. Museo Nacional de Ciencias Naturales, Madrid. España.Fotos