cURL / Mailing Lists / curl-users / Single Mail

curl-users

curl loop hangs

From: Ronald Müller <ronald.mueller_at_gmail.com>
Date: Fri, 21 Oct 2011 17:23:34 +0200

Dear mailing list members!

I have a script that sends index requests to a search engine. This is done
for > 50.000 documents using HTTP requests. Before this script transfers the
document data to the search engine, it first sends a HTTP request to the
status URL of the search engine. This must be done before for each document
before sending the data.

My script uses Curl (7.22.0) to send the status requests. For all 50.000
documents this is done very fast in a short time range. On most systems this
works without any problems. But there is one system my curl command
sometimes hangs. Then it doesn't return or gets a timeout. It just hangs.
The problem even occurs if the search engine doesn't run (and the requested
port isn't available).

Here is a (very) simplified version of my script. On most of my systems this
script runs without any problems and without hang. But on the one system
this test script hangs after a while, even if the requested host/port isn't
available/open.

Do you have a hint what could cause the hang on the problematic system?

#!/bin/bash

for i in {1..100000} ; do
   echo "Cycle: $i"
   curl -transfer http://localhost:11111/port/does/not/exist
done

###

Output of the script
..
..
Cycle: 15973
curl: (7) couldn't connect to host
Cycle: 15974
curl: (7) couldn't connect to host
Cycle: 15975
curl: (7) couldn't connect to host
Cycle: 15976
curl: (7) couldn't connect to host

GET /port/does/not/exist/ HTTP/1.1
User-Agent: curl/7.22.0 (i686-redhat-linux-gnu) libcurl/7.22.0
OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5
Host: localhost:11111
Accept: */*

--> Here the script just hangs and doesn't return.

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ: http://curl.haxx.se/docs/faq.html
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-10-21