FAQ
I have a site that uses a net/http based server. I recently configured
CloudFlare in front of it. (CloudFlare is a caching CDN-esque proxy that
tends to speed up sites and protects them from common web attacks) Much to
my surprise, I found my server with over 500 established connections to
various CloudFlare servers. After some investigation it appears that
http.Server is unable to timeout idle keep-alive connections. And
apparently, CloudFlare has a bug where they also never give up on an idle
connection. Strangely, they never give up on an idle connection even after
the original client closes their side of the connection. For now, I've set
a conservative ReadTimeout which should at least close the connections
after some time. But what I really want to do is to close the connection
when I know it has been idle for a short time. Any thoughts?

--

Search Discussions

  • Minux at Dec 20, 2012 at 12:48 pm

    On Thu, Dec 20, 2012 at 10:32 AM, wrote:

    I have a site that uses a net/http based server. I recently configured
    CloudFlare in front of it. (CloudFlare is a caching CDN-esque proxy that
    tends to speed up sites and protects them from common web attacks) Much to
    my surprise, I found my server with over 500 established connections to
    various CloudFlare servers. After some investigation it appears that
    http.Server is unable to timeout idle keep-alive connections. And
    apparently, CloudFlare has a bug where they also never give up on an idle
    connection. Strangely, they never give up on an idle connection even after
    the original client closes their side of the connection. For now, I've set
    a conservative ReadTimeout which should at least close the connections
    after some time. But what I really want to do is
    I'm pretty surprised to see this behavior as it means net/http would leak
    connections.
    My experiments against godoc shows that once the client closes the write
    side of the connection, that connection is
    immediate closed by the http server.
    Only when the client closes only the read side of the connection, does the
    server keep the idle connection.

    --

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedDec 20, '12 at 6:03a
activeDec 20, '12 at 12:48p
posts2
users2
websitegolang.org

2 users in discussion

Kellegous: 1 post Minux: 1 post

People

Translate

site design / logo © 2022 Grokbase