Thanks for the extra details, I was able to reproduce the problem here.

Here are the steps:

$ lxc launch ubuntu-daily:jammy dnsmasq-cpu-bug
$ lxc shell dnsmasq-cpu-bug
# apt update
# apt install -y dnsmasq
# systemctl disable --now systemd-resolved.service
# systemctl start dnsmasq.service
# dig gnu.org

In another terminal, you can shell into the container and do an "htop"
to check that dnsmasq will be using 100% of one CPU core.

I was able to reproduce this all the way back to Focal, but Bionic isn't
impacted by this bug.

I believe it's worth trying to report it upstream and seeing if this
rings any bells.  I'm going to include this bug in our backlog; right
now everybody from the Ubuntu Server team is busy with the upcoming
Kinetic release.

mixmastamyk, if you feel like reporting this upstream please post the
link to the email thread here so that we can keep an eye on it.

Thanks.

** Also affects: dnsmasq (Ubuntu Focal)
   Importance: Undecided
       Status: New

** Also affects: dnsmasq (Ubuntu Kinetic)
   Importance: Undecided
       Status: Incomplete

** Also affects: dnsmasq (Ubuntu Jammy)
   Importance: Undecided
       Status: New

** Changed in: dnsmasq (Ubuntu Focal)
       Status: New => Triaged

** Changed in: dnsmasq (Ubuntu Jammy)
       Status: New => Triaged

** Changed in: dnsmasq (Ubuntu Kinetic)
       Status: Incomplete => Triaged

** Changed in: dnsmasq (Ubuntu Focal)
   Importance: Undecided => Medium

** Changed in: dnsmasq (Ubuntu Kinetic)
   Importance: Undecided => Medium

** Changed in: dnsmasq (Ubuntu Jammy)
   Importance: Undecided => Medium

-- 
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/1980146

Title:
  dnsmasq often using 100% of CPU

Status in dnsmasq package in Ubuntu:
  Triaged
Status in dnsmasq source package in Focal:
  Triaged
Status in dnsmasq source package in Jammy:
  Triaged
Status in dnsmasq source package in Kinetic:
  Triaged

Bug description:
  Release:      22.04
  Codename:     jammy
  Kernel:         Linux 5.15.0-40-generic x86_64

  ⏵ apt-cache policy dnsmasq
    Installed: 2.86-1.1ubuntu0.1

  dnsmasq is caught in a loop after every dns request, resulting in 100%
  CPU usage for several minutes each time.  This leads to a hot and
  lethargic computer.  During this time thousands of the following
  messages (see below) are printed from strace.

  The loop tends to obsess on denied connections, but there are so many
  I'm not 100% sure.

  systemd-resolved is _not_ running, some bugs refer to that.

  ⏵ head /etc/dnsmasq.d/foo.conf

  address=/#/127.0.0.2
  port=53
  resolv-file=/var/run/NetworkManager/resolv.conf

  ⏵ sudo strace -p 3519  (dnsmasq)

  poll([{fd=3, events=POLLIN}, {fd=4, events=POLLIN}, {fd=5,
  events=POLLIN}, {fd=6, events=POLLIN}, {fd=7, events=POLLIN}, {fd=8,
  events=POLLIN}, {fd=9, events=POLLIN}, {fd=13, events=POLLIN}, {fd=14,
  events=POLLIN}], 9, -1) = 1 ([{fd=4, revents=POLLIN}])

  recvmsg(4, {msg_name={sa_family=AF_INET, sin_port=htons(60224),
  sin_addr=inet_addr("127.0.0.1")}, msg_namelen=28 => 16,
  msg_iov=[{iov_base="\302\221\1\0\0\1\0\0\0\0\0\0\17classify-
  client\10ser"..., iov_len=4096}], msg_iovlen=1,
  msg_control=[{cmsg_len=28, cmsg_level=SOL_IP, cmsg_type=IP_PKTINFO,
  cmsg_data={ipi_ifindex=if_nametoindex("lo"),
  ipi_spec_dst=inet_addr("127.0.0.53"),
  ipi_addr=inet_addr("127.0.0.53")}}], msg_controllen=32, msg_flags=0},
  0) = 54

  ioctl(4, SIOCGIFNAME, {ifr_ifindex=1, ifr_name="lo"}) = 0

  sendto(14, "\302\221\1\0\0\1\0\0\0\0\0\0\17classify-client\10ser"...,
  54, 0, {sa_family=AF_INET, sin_port=htons(53),
  sin_addr=inet_addr("127.0.0.53")}, 16) = 54

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/dnsmasq/+bug/1980146/+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