cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: cURL processes hanging when run via a system call

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Wed, 15 Feb 2006 10:51:26 +0100 (CET)

On Tue, 14 Feb 2006, Chris Tata wrote:

> This code is executed 1000's of times in a loop per daemon iteration. The
> command is successful around 95% of the time, but on occasion hangs
> indefinitely. Looking at the process status I see these 2 processes:

What protocols are you using when this happens? Anything in particular you've
found that unite the "hanging" processes and separate them from the ones that
don't hang?

> This process will hang indefinitely until I kill it and is always utilizing
> 98% CPU. This behavior, right off the bat, is strange since I am using the
> -m flag with 120 seconds. It will continue to hang for hours and hours.

Are you using a curl from the FreeBSD ports package or have you built it on
your own? IIRC, the FreeBSD ports version disables some parts of the timeout
code in curl (and I've never figured out why).

> Once I 'kill -9' the process, my program will either segfault or continue to
> run (depending on what side of the bed it woke up on that day)

A process cannot survive a kill -9, so I assume you meant a plain "kill" or
something here.

> Although it probably won't help in assessing the cause of cURL hanging, I
> was able to grab a stack trace during a bad hair day:

You could do two interesting things:

1 - strace (or whatever the FreeBSD equivalent is called) the live process and
     see what it is doing when it is stuck like this.

2 - build a debug version (probably using static libcurl) and attach gdb to
     the live process (using gdb -p) and figure out exactly what code it is
     executing and why

> Would switching to the cURL C API help me out here any?

I find that hard to tell without first understanding what causes this hang.

-- 
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
Received on 2006-02-15