When my machine doesn't get a reply from a DNS server, generally the
wifi router of the place where I'm drinking coffee, applications sit
in gethostbyname(3) "indefinitely". At least too long for me to wait
and I end up killing the app.
$ cat /etc/resolv.conf
# Generated by iwm0 dhclient
search Home
nameserver 192.168.1.1
lookup file bind
$ ifconfig iwm0
iwm0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
lladdr 52:77:a8:b1:cb:d3
index 2 priority 4 llprio 3
groups: wlan egress
media: IEEE802.11 autoselect (OFDM6)
status: no network
ieee80211: nwid arabiandays wpakey wpaprotos wpa2 wpaakms psk
wpaciphers ccmp wpagroupcipher ccmp
inet 192.168.1.6 netmask 0xffffff00 broadcast 192.168.1.255
If the router is down, such that iwm0 still has a configured address but
no link, mail/mutt will never show me my emails and instead enter the
following loop:
40907 mutt CALL clock_gettime(CLOCK_MONOTONIC,0x7f7fffff1eb8)
40907 mutt STRU struct timespec { 1497583.132191951 }
40907 mutt RET clock_gettime 0
40907 mutt CALL getpid()
40907 mutt RET getpid 40907/0x9fcb
40907 mutt CALL clock_gettime(CLOCK_MONOTONIC,0x7f7fffff1ea8)
40907 mutt STRU struct timespec { 1497583.132323039 }
40907 mutt RET clock_gettime 0
40907 mutt CALL
socket(AF_INET,0x5002<SOCK_DGRAM|SOCK_NONBLOCK|SOCK_DNS>,0)
40907 mutt RET socket 3
40907 mutt CALL connect(3,0x131fa3d046c0,16)
40907 mutt STRU struct sockaddr { AF_INET, 192.168.1.1:53 }
40907 mutt RET connect 0
40907 mutt CALL sendto(3,0x131f2ce71000,0x26,0,0,0)
40907 mutt GIO fd 3 wrote 38 bytes
"\r\M-L\^A\0\0\^A\0\0\0\0\0\0\^Eoliva
grenadille\^Cnet\0\0\^A\0\^A"
40907 mutt RET sendto 38/0x26
40907 mutt CALL clock_gettime(CLOCK_MONOTONIC,0x7f7fffff4090)
40907 mutt STRU struct timespec { 1497583.132641117 }
40907 mutt RET clock_gettime 0
40907 mutt CALL poll(0x7f7fffff40b8,1,5000)
40907 mutt STRU struct pollfd { fd=3, events=0x1<POLLIN>, revents=0<> }
40907 mutt RET poll 0
40907 mutt CALL recvfrom(3,0x131f581ac000,0x1000,0,0,0)
40907 mutt RET recvfrom -1 errno 35 Resource temporarily unavailable
40907 mutt CALL close(3)
40907 mutt RET close 0
40907 mutt CALL
socket(AF_INET,0x5002<SOCK_DGRAM|SOCK_NONBLOCK|SOCK_DNS>,0)
40907 mutt RET socket 3
40907 mutt CALL connect(3,0x131fa3d046c0,16)
40907 mutt STRU struct sockaddr { AF_INET, 192.168.1.1:53 }
40907 mutt RET connect 0
40907 mutt CALL sendto(3,0x131f2ce71000,0x26,0,0,0)
40907 mutt GIO fd 3 wrote 38 bytes
"\r\M-L\^A\0\0\^A\0\0\0\0\0\0\^Eoliva
grenadille\^Cnet\0\0\^A\0\^A"
40907 mutt RET sendto 38/0x26
40907 mutt CALL clock_gettime(CLOCK_MONOTONIC,0x7f7fffff4090)
40907 mutt STRU struct timespec { 1497588.138787459 }
40907 mutt RET clock_gettime 0
40907 mutt CALL poll(0x7f7fffff40b8,1,10000)
40907 mutt STRU struct pollfd { fd=3, events=0x1<POLLIN>, revents=0<> }
40907 mutt RET poll 0
40907 mutt CALL recvfrom(3,0x131f581ac000,0x1000,0,0,0)
40907 mutt RET recvfrom -1 errno 35 Resource temporarily unavailable
40907 mutt CALL close(3)
40907 mutt RET close 0
40907 mutt CALL
socket(AF_INET,0x5002<SOCK_DGRAM|SOCK_NONBLOCK|SOCK_DNS>,0)
40907 mutt RET socket 3
40907 mutt CALL connect(3,0x131fa3d046c0,16)
40907 mutt STRU struct sockaddr { AF_INET, 192.168.1.1:53 }
40907 mutt RET connect 0
40907 mutt CALL sendto(3,0x131f2ce71000,0x26,0,0,0)
40907 mutt GIO fd 3 wrote 38 bytes
"\r\M-L\^A\0\0\^A\0\0\0\0\0\0\^Eoliva
grenadille\^Cnet\0\0\^A\0\^A"
40907 mutt RET sendto 38/0x26
40907 mutt CALL clock_gettime(CLOCK_MONOTONIC,0x7f7fffff4090)
40907 mutt STRU struct timespec { 1497598.148905650 }
40907 mutt RET clock_gettime 0
40907 mutt CALL poll(0x7f7fffff40b8,1,20000)
40907 mutt STRU struct pollfd { fd=3, events=0x1<POLLIN>, revents=0<> }
40907 mutt RET poll 0
40907 mutt CALL recvfrom(3,0x131f581ac000,0x1000,0,0,0)
40907 mutt RET recvfrom -1 errno 35 Resource temporarily unavailable
40907 mutt CALL close(3)
40907 mutt RET close 0
40907 mutt CALL
socket(AF_INET,0x5002<SOCK_DGRAM|SOCK_NONBLOCK|SOCK_DNS>,0)
40907 mutt RET socket 3
40907 mutt CALL connect(3,0x131fa3d046c0,16)
40907 mutt STRU struct sockaddr { AF_INET, 192.168.1.1:53 }
40907 mutt RET connect 0
40907 mutt CALL sendto(3,0x131f2ce71000,0x26,0,0,0)
40907 mutt GIO fd 3 wrote 38 bytes
"\r\M-L\^A\0\0\^A\0\0\0\0\0\0\^Eoliva
grenadille\^Cnet\0\0\^A\0\^A"
40907 mutt RET sendto 38/0x26
40907 mutt CALL clock_gettime(CLOCK_MONOTONIC,0x7f7fffff4090)
40907 mutt STRU struct timespec { 1497618.159182924 }
40907 mutt RET clock_gettime 0
40907 mutt CALL poll(0x7f7fffff40b8,1,40000)
40907 mutt STRU struct pollfd { fd=3, events=0x1<POLLIN>, revents=0<> }
40907 mutt PSIG SIGINT caught handler=0x131cc25a7010 mask=0<>
40907 mutt RET poll -1 errno 4 Interrupted system call
40907 mutt CALL kbind(0x7f7fffff3ab0,24,0x1e5a91fae0b80e45)
40907 mutt RET kbind 0
40907 mutt CALL sigreturn(0x7f7fffff3bb0)
40907 mutt RET sigreturn JUSTRETURN
40907 mutt CALL clock_gettime(CLOCK_MONOTONIC,0x7f7fffff40a0)
40907 mutt STRU struct timespec { 1497635.524198881 }
40907 mutt RET clock_gettime 0
40907 mutt CALL poll(0x7f7fffff40b8,1,22635)
40907 mutt STRU struct pollfd { fd=3, events=0x1<POLLIN>, revents=0<> }
40907 mutt PSIG SIGINT caught handler=0x131cc25a7010 mask=0<>
40907 mutt RET poll -1 errno 4 Interrupted system call
40907 mutt CALL sigreturn(0x7f7fffff3bb0)
40907 mutt RET sigreturn JUSTRETURN
40907 mutt CALL clock_gettime(CLOCK_MONOTONIC,0x7f7fffff40a0)
40907 mutt STRU struct timespec { 1497637.847133207 }
40907 mutt RET clock_gettime 0
40907 mutt CALL poll(0x7f7fffff40b8,1,2948)
40907 mutt STRU struct pollfd { fd=3, events=0x1<POLLIN>, revents=0<> }
40907 mutt PSIG SIGTERM caught handler=0x131cc25a6fd0 mask=0<>
40907 mutt RET poll -1 errno 4 Interrupted system call