Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Properly close UDP channel upon error #177

Merged
merged 1 commit into from Mar 12, 2021
Merged

Properly close UDP channel upon error #177

merged 1 commit into from Mar 12, 2021

Conversation

li-wjohnson
Copy link

We've been seeing an error very similar to the one in #95 - after an error, dnsjava would stop resolving anything and constantly time out. In our case it was also a truncated UDP response, which would fallback to TCP.

Through debugging I discovered that the errored-out channels stayed in the selector, constantly reading -1 and blocking any query sending from happening, making every query time out. What was happening is that channel.disconnect() was throwing an IOException ("network is unreachable"), so the channel was never closed and thus stuck in the selector. Changing the codepath to always call channel.close() resolved the issue.

@codecov-io
Copy link

Codecov Report

Merging #177 (054b507) into master (48785dd) will increase coverage by 0.03%.
The diff coverage is 0.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #177      +/-   ##
============================================
+ Coverage     53.14%   53.17%   +0.03%     
- Complexity     1863     1864       +1     
============================================
  Files           160      160              
  Lines         10485    10486       +1     
  Branches       1524     1524              
============================================
+ Hits           5572     5576       +4     
+ Misses         4526     4525       -1     
+ Partials        387      385       -2     
Impacted Files Coverage Δ Complexity Δ
src/main/java/org/xbill/DNS/NioUdpClient.java 0.00% <0.00%> (ø) 0.00 <0.00> (ø)
src/main/java/org/xbill/DNS/NioTcpClient.java 71.79% <0.00%> (+2.56%) 10.00% <0.00%> (+1.00%)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 48785dd...054b507. Read the comment docs.

@ibauersachs ibauersachs merged commit c0dfa36 into dnsjava:master Mar 12, 2021
@ibauersachs
Copy link
Member

Thanks for the investigation and fix!

@li-wjohnson
Copy link
Author

No problem at all! Thanks for the quick turnaround. I'll be eagerly waiting for a release :)

@ibauersachs ibauersachs added this to the 3.4 milestone Mar 12, 2021
@ibauersachs
Copy link
Member

Not sure when 3.4 will be out, snapshots are available on Maven Central though.

@ibauersachs
Copy link
Member

Or should be if GitHub weren't down...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants