txt parser: fix goroutine leak #570
Merged
Conversation
Codecov Report
@@ Coverage Diff @@
## master #570 +/- ##
=========================================
+ Coverage 58.3% 58.4% +0.09%
=========================================
Files 37 37
Lines 9865 9883 +18
=========================================
+ Hits 5752 5772 +20
+ Misses 3064 3063 -1
+ Partials 1049 1048 -1
Continue to review full report at Codecov.
|
The
is ugly, but I don't have a better idea. I'm pondering on adding a test (or figuring out one) |
Added leaktest: this branch:
master branch with test copied in:
|
When a higher level (grammar or syntax) error was encountered the lower level zlexer routine would be left open and trying to send more tokens on the channel c. This leaks a goroutine, per failed parse... This PR fixes this by signalling this error - by canceling a context - retrieving any remaining items from the channel, so zlexer can return. It also adds a goroutine leak test that can be re-used in other tests, the TestParseBadNAPTR test uses this leak detector. The private key parsing code had the same bug and is also fixed in this PR. Fixes #586 Fixes coredns/coredns#1233
This was referenced Nov 17, 2017
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.
When a higher level (grammar or syntax) error was encountered the lower
level zlexer routine would be left open. This leaks a goroutine.
This PR fixes this by signalling this error, retrieving any remaining
items from the channel, so zlexer can return.
Fixes #586
Fixes coredns/coredns#1233