From: bert hubert Date: Mon, 16 Dec 2013 12:19:52 +0000 (+0100) Subject: ok, so it turns out that poll, select and a few other system calls can return EINTR... X-Git-Tag: rec-3.6.0-rc1~293 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ee79512a7282c533cd4ae8be7f540ec721d2975d;p=pdns ok, so it turns out that poll, select and a few other system calls can return EINTR when we receive and interrupt, and we need to manually restart. man 7 signal makes for good reading on this case, as does http://blog.reverberate.org/2011/04/eintr-and-pc-loser-ing-is-better-case.html --- diff --git a/pdns/nameserver.cc b/pdns/nameserver.cc index 9c9eddf32..39c85a83a 100644 --- a/pdns/nameserver.cc +++ b/pdns/nameserver.cc @@ -410,9 +410,14 @@ DNSPacket *UDPNameserver::receive(DNSPacket *prefilled) pfd.revents = 0; } + retry:; + err = poll(&rfds[0], rfds.size(), -1); - if(err < 0) + if(err < 0) { + if(errno==EINTR) + goto retry; unixDie("Unable to poll for new UDP events"); + } BOOST_FOREACH(struct pollfd &pfd, rfds) { if(pfd.revents & POLLIN) {