[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Why does 'connect' take so long (sometimes) and can't be interrupted

From: Chet Ramey
Subject: Re: Why does 'connect' take so long (sometimes) and can't be interrupted?
Date: Fri, 16 Jun 2017 14:35:21 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.2.0

On 6/15/17 11:36 AM, address@hidden wrote:

>       Note, however, that it does eventually connect.  As far as I can tell, 
> it
>       does always eventually connect.
>       Needless to say, when I first hit this problem, I assumed it had hung, 
> and
>       when I tried to kill it, I ran into the problems described above.

It's all system calls. If it hangs in `connect', bash has to wait until
the system call returns one way or another.  There is no provision for a
timeout with connect, and any signal (e.g., SIGALRM) that bash tries to
set for a timeout will be deferred until connect completes or fails

>       Also note: In testing this, I found that if I do hit ^C while it is 
> hung,
>       then wait long enough, eventually it does exit as shown below:
> Elapsed time for this 'exec' ...      ^C^C^C^Cbash: connect: Connection 
> refused
> bash: /dev/tcp/localhost/12345: Connection refused

If that's a legit error, the problem might be with the server.

``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/

reply via email to

[Prev in Thread] Current Thread [Next in Thread]