curl / Mailing Lists / curl-library / Single Mail


persistent connections and dns changes

From: Justin Karneges <>
Date: Wed, 7 Jun 2017 20:48:45 -0700


It seems libcurl will reuse a persistent connection to a domain even if the
IP address of that domain changes (and the DNS record TTL has expired).
This means a host could be moved, but requests may keep going over an old
connection, possibly forever.

This is mainly a problem if the server at the original IP address isn't
shut down. Now you might think if a domain is moved then the original
server will eventually be decommissioned, but as many domains are virtual
hosted by stable providers this is not always the case. Removing a virtual
host doesn't necessarily mean clients will be disconnected, especially if
there are proxy or load balancing layers.

Any suggestions on how to deal with this problem? It doesn't look like the
API has a way to destroy existing connections when the multi interface is
used (other than tearing down the entire multi instance, which I suppose I
could do as a last resort).


Received on 2017-06-08