Skip to content

DNS hangs on invalid domain #156

@daurnimator

Description

@daurnimator

This hangs:

print(require"cqueues.socket".connect("wrong.invalid", 80):connect())

Whereas dig returns NXDOMAIN almost instantly.

Relevant strace output of lua sample (exited during hang):

socket(AF_INET, SOCK_DGRAM, IPPROTO_IP) = 4
fcntl(4, F_SETFD, FD_CLOEXEC)           = 0
fcntl(4, F_GETFL)                       = 0x2 (flags O_RDWR)
fcntl(4, F_SETFL, O_RDWR|O_NONBLOCK)    = 0
open("/dev/urandom", O_RDONLY|O_NOCTTY|O_NONBLOCK) = 5
fstat(5, {st_mode=S_IFCHR|0666, st_rdev=makedev(1, 9), ...}) = 0
poll([{fd=5, events=POLLIN}], 1, 10)    = 1 ([{fd=5, revents=POLLIN}])
read(5, "\241\253\337\243A\241\fs\320\363(\255\366\2505\346\364\215\25\233\262\325YN\312\201\324\21\352\255\177\304", 32) = 32
close(5)                                = 0
getuid()                                = 1000
bind(4, {sa_family=AF_INET, sin_port=htons(33483), sin_addr=inet_addr("0.0.0.0")}, 16) = 0
brk(0x967000)                           = 0x967000
connect(4, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("10.1.1.1")}, 16) = 0
sendto(4, "\263+\1\0\0\1\0\0\0\0\0\0\5wrong\7invalid\0\0\1\0\1", 31, 0, NULL, 0) = 31
recvfrom(4, 0x947064, 768, 0, NULL, NULL) = -1 EAGAIN (Resource temporarily unavailable)
recvfrom(4, 0x947064, 768, 0, NULL, NULL) = -1 EAGAIN (Resource temporarily unavailable)
epoll_create1(EPOLL_CLOEXEC)            = 5
eventfd2(0, EFD_CLOEXEC|EFD_NONBLOCK)   = 6
epoll_ctl(5, EPOLL_CTL_ADD, 6, {EPOLLIN, {u32=9729320, u64=9729320}}) = 0
write(6, "\1\0\0\0\0\0\0\0", 8)         = 8
epoll_wait(5, [{EPOLLIN, {u32=9729320, u64=9729320}}], 32, 0) = 1
epoll_ctl(5, EPOLL_CTL_ADD, 4, {EPOLLIN, {u32=9730880, u64=9730880}}) = 0
read(6, "\1\0\0\0\0\0\0\0", 8)          = 8
epoll_wait(5, [{EPOLLIN, {u32=9730880, u64=9730880}}], 32, -1) = 1
write(6, "\1\0\0\0\0\0\0\0", 8)         = 8
epoll_ctl(5, EPOLL_CTL_DEL, 4, 0x7ffff26147f0) = 0
recvfrom(4, "\263+\201\203\0\1\0\0\0\1\0\0\5wrong\7invalid\0\0\1\0\1\0"..., 768, 0, NULL, NULL) = 106
connect(4, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("10.1.1.1")}, 16) = 0
sendto(4, "\372\372\1\0\0\1\0\0\0\0\0\0\5wrong\7invalid\0\0\0\1\0\1", 32, 0, NULL, 0) = 32
recvfrom(4, 0x947da4, 768, 0, NULL, NULL) = -1 EAGAIN (Resource temporarily unavailable)
epoll_wait(5, [{EPOLLIN, {u32=9729320, u64=9729320}}], 32, 0) = 1
epoll_ctl(5, EPOLL_CTL_ADD, 4, {EPOLLIN, {u32=9730880, u64=9730880}}) = 0
read(6, "\1\0\0\0\0\0\0\0", 8)          = 8
epoll_wait(5, ^Cstrace: Process 8661 detached

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions