Interesting James,
so there is a little twist that might be related and lead to a resolution.

Usually the service of dnsmasq would add itself to the resolvconf server set.
It does so in:
start_resolvconf()
{
# If interface "lo" is explicitly disabled in /etc/default/dnsmasq
# Then dnsmasq won't be providing local DNS, so don't add it to
# the resolvconf server set.
        for interface in $DNSMASQ_EXCEPT
        do
                [ $interface = lo ] && return
        done

        # Also skip this if DNS functionality is disabled in /etc/dnsmasq.conf
        if grep -qs '^port=0' /etc/dnsmasq.conf; then
                return
        fi

        if [ -x /sbin/resolvconf ] ; then
                echo "nameserver 127.0.0.1" | /sbin/resolvconf -a lo.$NAME
        fi
        return 0
}

So I wonder if that "not adding to resolvconf is the actual way this is
fixed for you per https://askubuntu.com/a/968309/

So while the config says "do not server lo", what it really does to fix
your case is not adding it. That in turn one could test.

So once you are in the bad case could you try if
$ resolvconf -a lo.dnsmasq
would resolv the issue as well?

I currently fail to grasp all the potential regressions that change could have, 
but I'd think that knowing if
a) not serving on 127.0.0.1
or
b) not registering in resolvconf
is the actual trigger might help someone else to go further.

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to dnsmasq in Ubuntu.
https://bugs.launchpad.net/bugs/1670959

Title:
  systemd-resolved using 100% CPU

Status in dnsmasq package in Ubuntu:
  Confirmed
Status in systemd package in Ubuntu:
  Confirmed

Bug description:
  Sometimes systemd-resolved process is using 100% CPU.
  After a while it changes back to normal.

  It happens usually after connecting to the (wifi) network, like
  starting the OS.

  strace output:

  sendmsg(12, {msg_name(16)={sa_family=AF_INET, sin_port=htons(33589), 
sin_addr=inet_addr("127.0.0.1")}, 
msg_iov(1)=[{"6\215\201\200\0\1\0\1\0\0\0\1\4cs41\3wac\vedgecastcdn\3net\0\0\34\0\1\300\f\0\34\0\1\0\0\10\235\0\20&\6(\0\0024\0Y%L\4\6#f&\214\0\0)\377\326\0\0\0\0\0\0",
 81}], msg_controllen=28, [{cmsg_len=28, cmsg_level=SOL_IP, 
cmsg_type=IP_PKTINFO, {ipi_ifindex=if_nametoindex("lo"), 
ipi_spec_dst=inet_addr("127.0.0.53"), ipi_addr=inet_addr("127.0.0.53")}}], 
msg_flags=0}, 0) = 81
  sendmsg(3, {msg_name(0)=NULL, 
msg_iov(4)=[{"PRIORITY=6\nSYSLOG_FACILITY=3\nCODE_FILE=../src/resolve/resolved-dns-stub.c\nCODE_LINE=363\nCODE_FUNCTION=dns_stub_process_query\nSYSLOG_IDENTIFIER=systemd-resolved\n",
 160}, {"MESSAGE=", 8}, {"Processing query...", 19}, {"\n", 1}], 
msg_controllen=0, msg_flags=0}, MSG_NOSIGNAL) = 188
  epoll_wait(4, [{EPOLLIN, {u32=3176459184, u64=94565471415216}}], 16, -1) = 1
  clock_gettime(CLOCK_BOOTTIME, {44665, 938069872}) = 0
  recvfrom(12, NULL, 0, MSG_PEEK|MSG_TRUNC, NULL, NULL) = 53
  recvmsg(12, {msg_name(16)={sa_family=AF_INET, sin_port=htons(33589), 
sin_addr=inet_addr("127.0.0.1")}, 
msg_iov(1)=[{"Z\262\1\20\0\1\0\0\0\0\0\1\4cs41\3wac\vedgecastcdn\3net\0\0\34\0\1\0\0)\2\0\0\0\0\0\0\0",
 3936}], msg_controllen=56, [{cmsg_len=28, cmsg_level=SOL_IP, 
cmsg_type=IP_PKTINFO, {ipi_ifindex=if_nametoindex("lo"), 
ipi_spec_dst=inet_addr("127.0.0.53"), ipi_addr=inet_addr("127.0.0.53")}}, 
{cmsg_len=20, cmsg_level=SOL_IP, cmsg_type=IP_TTL, {ttl=64}}], msg_flags=0}, 0) 
= 53
  stat("/etc/resolv.conf", {st_mode=S_IFREG|0644, st_size=303, ...}) = 0
  getrandom("\365I", 2, GRND_NONBLOCK)    = 2
  stat("/etc/resolv.conf", {st_mode=S_IFREG|0644, st_size=303, ...}) = 0
  getrandom("\203;", 2, GRND_NONBLOCK)    = 2
  clock_gettime(CLOCK_BOOTTIME, {44665, 938446937}) = 0
  open("/run/systemd/netif/links/3", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such 
file or directory)
  stat("/etc/resolv.conf", {st_mode=S_IFREG|0644, st_size=303, ...}) = 0
  stat("/etc/resolv.conf", {st_mode=S_IFREG|0644, st_size=303, ...}) = 0
  socket(AF_INET, SOCK_DGRAM|SOCK_CLOEXEC|SOCK_NONBLOCK, IPPROTO_IP) = 18
  connect(18, {sa_family=AF_INET, sin_port=htons(53), 
sin_addr=inet_addr("127.0.0.1")}, 16) = 0
  epoll_ctl(4, EPOLL_CTL_ADD, 18, {EPOLLIN, {u32=3176610576, 
u64=94565471566608}}) = 0
  write(18, 
"\203;\1\20\0\1\0\0\0\0\0\1\4cs41\3wac\vedgecastcdn\3net\0\0\34\0\1\0\0)\2\0\0\0\0\0\0\0",
 53) = 53
  clock_gettime(CLOCK_BOOTTIME, {44665, 938833717}) = 0
  clock_gettime(CLOCK_BOOTTIME, {44665, 938875138}) = 0
  epoll_ctl(4, EPOLL_CTL_DEL, 18, NULL)   = 0
  close(18)                               = 0

  journalctl output:

  Mar 08 08:25:35 parsec systemd-resolved[1512]: Processing query...
  Mar 08 08:25:35 parsec systemd-resolved[1512]: Processing query...
  Mar 08 08:25:35 parsec systemd-resolved[1512]: Processing query...
  Mar 08 08:25:35 parsec systemd-resolved[1512]: Processing query...
  Mar 08 08:25:35 parsec systemd-resolved[1512]: Processing query...
  Mar 08 08:25:35 parsec systemd-resolved[1512]: Processing query...
  Mar 08 08:25:35 parsec systemd-resolved[1512]: Processing query...
  Mar 08 08:25:35 parsec systemd-resolved[1512]: Processing query...
  Mar 08 08:25:41 parsec dnsmasq[1545]: Maximum number of concurrent DNS 
queries reached (max: 150)

  As you can see, I would use it together with dnsmasq.

  ProblemType: Bug
  DistroRelease: Ubuntu 17.04
  Package: systemd 232-18ubuntu1
  ProcVersionSignature: Ubuntu 4.10.0-9.11-generic 4.10.0
  Uname: Linux 4.10.0-9-generic x86_64
  NonfreeKernelModules: zfs zunicode zavl zcommon znvpair
  ApportVersion: 2.20.4-0ubuntu2
  Architecture: amd64
  Date: Wed Mar  8 08:20:18 2017
  MachineType: Hewlett-Packard HP EliteBook Folio 1020 G1
  ProcEnviron:
   LANGUAGE=en_US:en
   TERM=xterm
   PATH=(custom, no user)
   LANG=en_US.UTF-8
   SHELL=/bin/zsh
  ProcKernelCmdLine: BOOT_IMAGE=/@/boot/vmlinuz-4.10.0-9-generic 
root=UUID=a54fe703-35d4-47ac-9c6e-4034421531fb ro rootflags=subvol=@
  SourcePackage: systemd
  UpgradeStatus: Upgraded to zesty on 2015-05-24 (653 days ago)
  dmi.bios.date: 03/09/2015
  dmi.bios.vendor: Hewlett-Packard
  dmi.bios.version: M77 Ver. 01.05
  dmi.board.name: 2271
  dmi.board.vendor: Hewlett-Packard
  dmi.board.version: KBC Version 91.4C
  dmi.chassis.asset.tag: CNU51199KV
  dmi.chassis.type: 10
  dmi.chassis.vendor: Hewlett-Packard
  dmi.modalias: 
dmi:bvnHewlett-Packard:bvrM77Ver.01.05:bd03/09/2015:svnHewlett-Packard:pnHPEliteBookFolio1020G1:pvrA3009DD18303:rvnHewlett-Packard:rn2271:rvrKBCVersion91.4C:cvnHewlett-Packard:ct10:cvr:
  dmi.product.name: HP EliteBook Folio 1020 G1
  dmi.product.version: A3009DD18303
  dmi.sys.vendor: Hewlett-Packard

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/dnsmasq/+bug/1670959/+subscriptions

-- 
Mailing list: https://launchpad.net/~touch-packages
Post to     : touch-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~touch-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to