pdnsutil zone list: give up if output stalls#16645
Draft
miodvallat wants to merge 1 commit intoPowerDNS:masterfrom
Draft
pdnsutil zone list: give up if output stalls#16645miodvallat wants to merge 1 commit intoPowerDNS:masterfrom
miodvallat wants to merge 1 commit intoPowerDNS:masterfrom
Conversation
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>
3823ac0 to
3d3949d
Compare
Pull Request Test Coverage Report for Build 20235479584Warning: 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
💛 - Coveralls |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Short description
We have had reports, when
pdnsutilruns in a container, that pipeing the output ofpdnsutil(running in the container) to a local process (not running in the container) can sometimes end up withpdnsutilstuck 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 listis not a tty, will:This is a currently a draft PR, as I would like some feedback, especially on the following points:
Note that, in the current state of this PR, if you
pdnsutil zone list what.ever|lessand idle inless,pdnsutilwill 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 "
pdnsutilrunning in a container" case mentioned above, there is zero chance the message will get seen and there would be a stuckpdnsutilprocess left.Also, there is no user documentation update yet until the preferred behaviour is decided.
Checklist
I have: