curl-library
libcurl cannot reconnect after some time
Date: Thu, 11 Jun 2009 04:55:19 -0700 (PDT)
Hi, I'm using libcurl as part of a simple application that sends a form to an HTTP Web server using a POST request. The application sends the form every 10 seconds to the same server. The application works fine for a number of iterations, but at some point something happens and stops working.
I have noticed that the application works fine during the first 2 hours and a half, and between that time and the third hour is when stops working. The first thing I thought it was that it could be a problem with the network, but then I have noticed that during the time when the application works fine there are network disconnections, IP addresses and name server reloads, etc., that libcurl handle with perfection.
After this time, libcurl simply lost the connection to the server and can't reconnect again, regardless of the time you wait. Even more, when I use the server name instead of the server IP to connect the server, after this time libcurl can't resolve the address for the server. I haven't found anything suspect neither in the syslog nor in the Apache logs.
Does anybody can give me a hint? This problem is driving me crazy.
Thanks in advance.
Best regards,
Erik
--- System description: libcurl 7.18.2 Ubuntu Desktop 8.10 gcc version 4.3.2 Apache/2.2.9 (Ubuntu) PHP/5.2.6-2ubuntu4.2 with Suhosin Patch --- Debug trace: == Info: About to connect() to servername.domain port 80 (#0) == Info: Trying 10.20.30.40... == Info: Bind local address to 10.20.30.40 == Info: Local port: 60251 == Info: connected == Info: Connected to servername.domain (10.20.30.40) port 80 (#0) => Send header, 210 bytes (0xd2) … == Info: Connection #0 to host servername.domain left intact --- More debug traces: == Info: Re-using existing connection! (#0) with host servername.domain == Info: Connected to servername.domain (10.20.30.40) port 80 (#0) => Send header, 210 bytes (0xd2) … == Info: Connection #0 to host servername.domain left intact --- Debug trace of the error when using the server name to establish the connection: == Info: getaddrinfo(3) failed for servername.domain:80 == Info: Couldn't resolve host 'servername.domain' == Info: Closing connection #0 --- Debug trace of the error when using the server IP address instead of the server name: == Info: About to connect() to 10.20.30.40 port 80 (#0) == Info: couldn't connect to host == Info: Closing connection #0 --- Information from netstat: tcp 0 0 10.20.30.40:60251 10.20.30.40:80 ESTABLISHED tcp6 0 0 10.20.30.40:80 10.20.30.40:60251 ESTABLISHED --- Apache configuration: KeepAlive On MaxKeepAliveRequests 100 KeepAliveTimeout 15Received on 2009-06-11