Skip to content

Conversation

@miodvallat
Copy link
Contributor

@miodvallat miodvallat commented Dec 15, 2025

Short description

We have had reports, when pdnsutil runs in a container, that pipeing the output of pdnsutil (running in the container) to a local process (not running in the container) can sometimes end up with pdnsutil stuck in a blocking call to write to the pipe, although the pipe reader on the local machine is long gone.

Of course the container is to blame for not implementing proper pipe semantics, but it look like it's pdnsutil's fault, so we have to do something.

This PR, when pdnsutil zone list is not a tty, will:

  • enable non-blocking mode on stdout
  • monitor its own output progress, and abort listing zone contents if the output stalls for 30 seconds.

This is a currently a draft PR, as I would like some feedback, especially on the following points:

  • do we want this to be the default behaviour, or should it be explicitly required with an option?
  • do we want the 30 second timeout to be configurable?

Note that, in the current state of this PR, if you pdnsutil zone list what.ever|less and idle in less, pdnsutil will abort after 30 seconds and you will only get an incomplete listing.

I have considered switching back to blocking i/o and write an error, but in the "pdnsutil running in a container" case mentioned above, there is zero chance the message will get seen and there would be a stuck pdnsutil process left.

Also, there is no user documentation update yet until the preferred behaviour is decided.

Checklist

I have:

  • read the CONTRIBUTING.md document
  • read and accepted the Developer Certificate of Origin document, including the AI Policy, and added a "Signed-off-by" to my commits
  • compiled this code
  • tested this code
  • included documentation (including possible behaviour changes)
  • documented the code
  • added or modified regression test(s)
  • added or modified unit test(s)

We have noticed that some container solutions do not appear to implement
proper pipe semantics, and it is possible to end up with pdnsutil processes
stuck sleeping because the pipe no longer has any readers, but no SIGPIPE
is generated.

In order to mitigate this, we switch stdout to non-blocking if output is not
a tty, and monitor output progress; if output stalls for an arbitrary 30
seconds, we abort the listing operation. This allows us to not lead an open
read transaction on LMDB backends.

Signed-off-by: Miod Vallat <miod.vallat@powerdns.com>
@miodvallat miodvallat force-pushed the pdnsutil_eulenspiegel branch from 3823ac0 to 3d3949d Compare December 15, 2025 14:20
@coveralls
Copy link

coveralls commented Dec 15, 2025

Pull Request Test Coverage Report for Build 20235479584

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 100 unchanged lines in 9 files lost coverage.
  • Overall coverage increased (+5.2%) to 73.335%

Files with Coverage Reduction New Missed Lines %
pdns/dnsdistdist/dnsdist-async.cc 2 54.93%
pdns/recursordist/rec-eventtrace.hh 2 58.41%
pdns/recursordist/test-syncres_cc1.cc 5 90.26%
pdns/auth-secondarycommunicator.cc 7 66.14%
pdns/recursordist/taskqueue.cc 9 35.9%
pdns/packethandler.cc 11 72.28%
pdns/recursordist/syncres.cc 13 81.05%
modules/godbcbackend/sodbc.cc 17 70.08%
pdns/recursordist/rec-taskqueue.cc 34 40.14%
Totals Coverage Status
Change from base Build 20235461982: 5.2%
Covered Lines: 128790
Relevant Lines: 164859

💛 - Coveralls

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants