Bug 274352 - unbound stop working - infinite loop in comm_point_send_udp_msg()
Summary: unbound stop working - infinite loop in comm_point_send_udp_msg()
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 13.2-RELEASE
Hardware: Any Any
: --- Affects Some People
Assignee: Cy Schubert
URL:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2023-10-08 12:57 UTC by Jean-Claude MICHOT
Modified: 2023-10-16 04:03 UTC (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jean-Claude MICHOT 2023-10-08 12:57:05 UTC
rgw:/etc/unbound # freebsd-version -uk
13.2-RELEASE
13.2-RELEASE

rgw:/etc/unbound # /usr/sbin/local-unbound -V
Version 1.17.1

Configure line: --with-ssl=/usr --with-libexpat=/usr --disable-dnscrypt --disable-dnstap --enable-ecdsa --disable-event-api --enable-gost --with-libevent --disable-subnet --disable-tfo-client --disable-tfo-server --with-pthreads--prefix=/usr --localstatedir=/var/unbound --mandir=/usr/share/man --build=freebsd
Linked libs: mini-event internal (it uses select), OpenSSL 1.1.1t-freebsd  7 Feb 2023
Linked modules: dns64 respip validator iterator

BSD licensed, see LICENSE in source package for details.
Report bugs to unbound-bugs@nlnetlabs.nl or https://github.com/NLnetLabs/unbound/issues

ktrace of unbound running process show loop:

  1005 local-unbound CALL  sendto(0x9,0x2562128aa400,0x2d,0,0,0)
  1005 local-unbound RET   sendto -1 errno 55 No buffer space available
  1005 local-unbound CALL  poll(0x25620a5796a8,0x1,0xc8)
  1005 local-unbound RET   poll 1
  1005 local-unbound CALL  sendto(0x9,0x2562128aa400,0x2d,0,0,0)
  1005 local-unbound RET   sendto -1 errno 55 No buffer space available
  1005 local-unbound CALL  poll(0x25620a5796a8,0x1,0xc8)
  1005 local-unbound RET   poll 1
  1005 local-unbound CALL  sendto(0x9,0x2562128aa400,0x2d,0,0,0)
  1005 local-unbound RET   sendto -1 errno 55 No buffer space available
  1005 local-unbound CALL  poll(0x25620a5796a8,0x1,0xc8)
  1005 local-unbound RET   poll 1
  1005 local-unbound CALL  sendto(0x9,0x2562128aa400,0x2d,0,0,0)
  1005 local-unbound RET   sendto -1 errno 55 No buffer space available
  1005 local-unbound CALL  poll(0x25620a5796a8,0x1,0xc8)
  1005 local-unbound RET   poll 1
  1005 local-unbound CALL  sendto(0x9,0x2562128aa400,0x2d,0,0,0)
  1005 local-unbound RET   sendto -1 errno 55 No buffer space available
  1005 local-unbound CALL  poll(0x25620a5796a8,0x1,0xc8)
  1005 local-unbound RET   poll 1
  1005 local-unbound CALL  sendto(0x9,0x2562128aa400,0x2d,0,0,0)
  1005 local-unbound RET   sendto -1 errno 55 No buffer space available
  1005 local-unbound CALL  poll(0x25620a5796a8,0x1,0xc8)
  1005 local-unbound RET   poll 1
  1005 local-unbound CALL  sendto(0x9,0x2562128aa400,0x2d,0,0,0)
  1005 local-unbound RET   sendto -1 errno 55 No buffer space available
  1005 local-unbound CALL  poll(0x25620a5796a8,0x1,0xc8)
  1005 local-unbound RET   poll 1
  1005 local-unbound CALL  sendto(0x9,0x2562128aa400,0x2d,0,0,0)
  1005 local-unbound RET   sendto -1 errno 55 No buffer space available
  1005 local-unbound CALL  poll(0x25620a5796a8,0x1,0xc8)
  1005 local-unbound RET   poll 1
.../...

I think it's an infinite loop inside netevent.c / comm_point_send_udp_msg()

while(sent == -1 && ( .../...

variable "pret" never get 0 and we are locked in loop using 100% of CPU,
of course in this case unbound is unable to resolve request or reply
to command local-unbound-control

JC
Comment 1 Jean-Claude MICHOT 2023-10-09 07:51:28 UTC
Already reported by OpenBSD team, it's fixed in current unbound 
https://github.com/NLnetLabs/unbound/commit/0ee44ef384593ed0382d1ce6048d5a9c9440b45c
need to be back-ported in FreeBSD.
Comment 2 Mark Johnston freebsd_committer freebsd_triage 2023-10-12 23:32:16 UTC
Cy, is there any reason not to backport the patch referenced in comment 1?
Comment 3 Cy Schubert freebsd_committer freebsd_triage 2023-10-12 23:47:02 UTC
(In reply to Mark Johnston from comment #2)
I just got back from vacation today. The patch has been imported into vendor and I'll test it here.
Comment 4 commit-hook freebsd_committer freebsd_triage 2023-10-13 00:07:42 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=6e71235e558ef579605e7f35b02f983b9a246a4a

commit 6e71235e558ef579605e7f35b02f983b9a246a4a
Merge: 32557d16e2c3 292d51198aa3
Author:     Cy Schubert <cy@FreeBSD.org>
AuthorDate: 2023-10-13 00:04:25 +0000
Commit:     Cy Schubert <cy@FreeBSD.org>
CommitDate: 2023-10-13 00:04:25 +0000

    unbound: Import upstream 0ee44ef3 when ENOBUFS is returned

    From upstream 0ee44ef3:

    - Fix send of udp retries when ENOBUFS is returned. It stops looping
      and also waits for the condition to go away. Reported by Florian
      Obser.

    PR:             274352
    MFC after:      3 days

    Merge commit '292d51198aa319c58f534549851e9c28486abdf4'

 contrib/unbound/.gitignore (new) |   1 +
 contrib/unbound/util/netevent.c  | 102 ++++++++++++++++++++++++++++++++++++++-
 2 files changed, 101 insertions(+), 2 deletions(-)
Comment 5 commit-hook freebsd_committer freebsd_triage 2023-10-13 13:23:23 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=05c229e187e0dd8d812db2ebb10f74ca1c423efc

commit 05c229e187e0dd8d812db2ebb10f74ca1c423efc
Author:     Cy Schubert <cy@FreeBSD.org>
AuthorDate: 2023-10-13 02:04:20 +0000
Commit:     Cy Schubert <cy@FreeBSD.org>
CommitDate: 2023-10-13 13:21:05 +0000

    dns/unbound: Fix loop when ENOBUFS is returned

    - Fix send of udp retries when ENOBUFS is returned. It stops looping
      and also waits for the condition to go away. Reported to upstream
      by Florian Obser.

    PR:             274352, 274446
    Approved by:    jaap@NLnetLabs.nl (maintainer)
    MFH:            2023Q4

 dns/unbound/Makefile                     |   1 +
 dns/unbound/files/patch-netevent.c (new) | 159 +++++++++++++++++++++++++++++++
 2 files changed, 160 insertions(+)
Comment 6 commit-hook freebsd_committer freebsd_triage 2023-10-14 00:18:28 UTC
A commit in branch 2023Q4 references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=0706b7c3f62cdf724ca43d361918932202a91fe3

commit 0706b7c3f62cdf724ca43d361918932202a91fe3
Author:     Cy Schubert <cy@FreeBSD.org>
AuthorDate: 2023-10-13 02:04:20 +0000
Commit:     Cy Schubert <cy@FreeBSD.org>
CommitDate: 2023-10-13 23:55:41 +0000

    dns/unbound: Fix loop when ENOBUFS is returned

    - Fix send of udp retries when ENOBUFS is returned. It stops looping
      and also waits for the condition to go away. Reported to upstream
      by Florian Obser.

    PR:             274352, 274446
    Approved by:    jaap@NLnetLabs.nl (maintainer)

    (cherry picked from commit 05c229e187e0dd8d812db2ebb10f74ca1c423efc)

 dns/unbound/Makefile                     |   1 +
 dns/unbound/files/patch-netevent.c (new) | 159 +++++++++++++++++++++++++++++++
 2 files changed, 160 insertions(+)
Comment 7 commit-hook freebsd_committer freebsd_triage 2023-10-16 04:00:51 UTC
A commit in branch stable/14 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=8a9416b18f8a894c4bb0c3a284746d5e0bc81152

commit 8a9416b18f8a894c4bb0c3a284746d5e0bc81152
Author:     Cy Schubert <cy@FreeBSD.org>
AuthorDate: 2023-10-13 00:04:25 +0000
Commit:     Cy Schubert <cy@FreeBSD.org>
CommitDate: 2023-10-16 04:00:00 +0000

    unbound: Import upstream 0ee44ef3 when ENOBUFS is returned

    From upstream 0ee44ef3:

    - Fix send of udp retries when ENOBUFS is returned. It stops looping
      and also waits for the condition to go away. Reported by Florian
      Obser.

    PR:             274352

    Merge commit '292d51198aa319c58f534549851e9c28486abdf4'

    (cherry picked from commit 6e71235e558ef579605e7f35b02f983b9a246a4a)

 contrib/unbound/.gitignore (new) |   1 +
 contrib/unbound/util/netevent.c  | 102 ++++++++++++++++++++++++++++++++++++++-
 2 files changed, 101 insertions(+), 2 deletions(-)
Comment 8 commit-hook freebsd_committer freebsd_triage 2023-10-16 04:00:53 UTC
A commit in branch stable/13 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=64ac3bca3a6ec8510ae7175cbdd73aa594756e2a

commit 64ac3bca3a6ec8510ae7175cbdd73aa594756e2a
Author:     Cy Schubert <cy@FreeBSD.org>
AuthorDate: 2023-10-13 00:04:25 +0000
Commit:     Cy Schubert <cy@FreeBSD.org>
CommitDate: 2023-10-16 04:00:36 +0000

    unbound: Import upstream 0ee44ef3 when ENOBUFS is returned

    From upstream 0ee44ef3:

    - Fix send of udp retries when ENOBUFS is returned. It stops looping
      and also waits for the condition to go away. Reported by Florian
      Obser.

    PR:             274352

    Merge commit '292d51198aa319c58f534549851e9c28486abdf4'

    (cherry picked from commit 6e71235e558ef579605e7f35b02f983b9a246a4a)

 contrib/unbound/.gitignore (new) |   1 +
 contrib/unbound/util/netevent.c  | 102 ++++++++++++++++++++++++++++++++++++++-
 2 files changed, 101 insertions(+), 2 deletions(-)
Comment 9 commit-hook freebsd_committer freebsd_triage 2023-10-16 04:01:54 UTC
A commit in branch stable/12 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=7d9c0fb578931f7f622970bad40d799abd74a76f

commit 7d9c0fb578931f7f622970bad40d799abd74a76f
Author:     Cy Schubert <cy@FreeBSD.org>
AuthorDate: 2023-10-13 00:04:25 +0000
Commit:     Cy Schubert <cy@FreeBSD.org>
CommitDate: 2023-10-13 01:54:35 +0000

    unbound: Import upstream 0ee44ef3 when ENOBUFS is returned

    From upstream 0ee44ef3:

    - Fix send of udp retries when ENOBUFS is returned. It stops looping
      and also waits for the condition to go away. Reported by Florian
      Obser.

    PR:             274352

    Merge commit '292d51198aa319c58f534549851e9c28486abdf4'

    (cherry picked from commit 6e71235e558ef579605e7f35b02f983b9a246a4a)

 contrib/unbound/.gitignore (new) |   1 +
 contrib/unbound/util/netevent.c  | 102 ++++++++++++++++++++++++++++++++++++++-
 2 files changed, 101 insertions(+), 2 deletions(-)