I believe .netrc should be 0600 (read and write by owner), not 0400 (read only). At least it is so in my docs.
.. this might not be a correct assumption..
Is that a far-reaching enough sample of your actual script -- the host lookup method by itself doesn't really "do" anything. However if you do (attempt) an actual ftp login you would get the hang/lockup if for any reason the ftp data connection cannot be built, for firewall rules or whatever reason.. just a thought. The default timeout is probably like 60 seconds.. a veritable eternity..