[CentOS] A question about why the function "recv" return 0

Fred Smith
Mon, 17 Dec 2018 17:58:36 -0000

On Mon, Dec 17, 2018 at 01:30:14PM +0800, yf chu wrote:
> I am a website developer.  We deploy a Nginx server on centos to provide
HTTP services. Recently, some customers of our website were complaining about
that occasionally they could not open the webpage, the web browser show that the
tcp connection was reset.  I checked the Nginx logs and source code and found
that the function "recv" return 0 when some customers made HTTP
requests. Our customers have confirmed that their network was ok at that time.
Now, I could not find any clue about this issue. Is there any solution to find
the reason? Does it have something to do with firewall, or ISP? Can we find
something from the system log?

All my references say that recv() returns zero when the link has been
shut down cleanly by the other end.

You say that the other end hasn't done so, but possibly there are one
or more proxies in the middle,... maybe one of them has dropped the
link for some reason.

--
---- Fred Smith -- fredex at fcshome.stoneham.ma.us
-----------------------------
   "For the word of God is living and active. Sharper than any double-edged
   sword, it penetrates even to dividing soul and spirit, joints and marrow;
              it judges the thoughts and attitudes of the heart."
---------------------------- Hebrews 4:12 (niv) ------------------------------