I can't think of what could cause this problem. The TCP connection code in Bash seems pretty straightforward, and in my experiments I was able to interrupt it even if it was waiting for the server to accept a connection, or waiting for an available slot in the listen queue. It's possible the problem is in your C code. Would you be able to post a version of it that exhibits the problem?
----- Original Message ----- From: gaze...@xmission.com To:<bug-bash@gnu.org> Cc: Sent:Thu, 15 Jun 2017 09:36:12 -0600 Subject:Why does 'connect' take so long (sometimes) and can't be interrupted? Description: This is a little complicated and I can't give you full details on how to replicate it, since I don't fully understand it myself. But under certain circumstances, the following line takes a very long time to execute: exec 5<>/dev/tcp/localhost/12345 My objections are twofold: a) That it takes so long - it should either succeed or file (almost) immediately. b) When it is running, it is uninterruptable. None of ^C, ^, or ^Z, nor any signal sent to the bash process (other than SIGKILL) will cause it to exit. Effectively, the only escape is to SIGKILL the bash process, which causes the entire shell to be killed.