From: Eric Hodel Date: 2005-01-24T17:36:38+09:00 Subject: Re: TCPSocket.new blocks other threads --Apple-Mail-48--600429779 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed On 24 Jan 2005, at 00:05, martinus wrote: > This is a serious problem! Try this code without an internet > connection: > > Thread.new { > sleep 1 > TCPSocket.new("xxx.nonexisting.xxx", 1234) ^^^^^^^^^^^^^^^^^^^^^ With Thread.abort_on_exception = true causes: getaddrinfo: No address associated with nodename (SocketError) after 1 second. So this is not a TCPSocket-specific problem, but a DNS resolver problem, probably due to your OS' DNS resolver library performing a blocking call of some kind. There's nothing Ruby can do about this, unless your system provides a non-blocking DNS resolver API. Changing it to a non-local IP address with no network connection causes: No route to host - connect(2) (Errno::EHOSTUNREACH) after 1 second. Adding a network connection causes it to print . until the network connection times out on: ruby 1.8.2 (2004-12-25) [powerpc-darwin7.7.0] -- Eric Hodel - drbrain@segment7.net - http://segment7.net FEC2 57F1 D465 EB15 5D6E 7C11 332A 551C 796C 9F04 --Apple-Mail-48--600429779 content-type: application/pgp-signature; x-mac-type=70674453; name=PGP.sig content-description: This is a digitally signed message part content-disposition: inline; filename=PGP.sig content-transfer-encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (Darwin) iD8DBQFB9LONMypVHHlsnwQRAnHyAKCUg9cuWceYdP57emmeM7DvvFu0xgCdEpyq tbvgHG74hs6wkvgrF+PbMf0= =BCYn -----END PGP SIGNATURE----- --Apple-Mail-48--600429779--