Skip to content

Conversation

@ibauersachs
Copy link
Member

Closes #379
Closes #380

@codecov
Copy link

codecov bot commented Jun 14, 2025

Codecov Report

Attention: Patch coverage is 70.90909% with 16 lines in your changes missing coverage. Please review.

Project coverage is 66.13%. Comparing base (59eb83b) to head (6e700d8).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
src/main/java/org/xbill/DNS/NioClient.java 72.22% 10 Missing and 5 partials ⚠️
src/main/java/org/xbill/DNS/NioUdpClient.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master     #381      +/-   ##
============================================
- Coverage     66.25%   66.13%   -0.12%     
- Complexity     3021     3024       +3     
============================================
  Files           198      198              
  Lines         13519    13544      +25     
  Branches       2104     2109       +5     
============================================
+ Hits           8957     8958       +1     
- Misses         4015     4030      +15     
- Partials        547      556       +9     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

@bhaveshthakker bhaveshthakker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall LGTM!

close(false);
}

private static void close(boolean fromHook) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now, since the close() function is not actually closing the selector, can we rename this to either of markForClose(), markForShutdown(), scheduleClose(), etc. Close() is misleading!

Also, now since the logic for close is not very sequentially straightforward, possibly we can add a comment over the function what this function does and how selector will read the flag later to actually close it

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now, since the close() function is not actually closing the selector, can we rename this to either of markForClose(), markForShutdown(), scheduleClose(), etc. Close() is misleading!

No, because close() is part of the public API and dnsjava follows SemVer.

What we could do is to remove the local* variables and close directly inside the lock. I don't quite see the benefit of this though, since calling selector() is possible again once close() has returned.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh yes! closer() is public!! Well then adding a javadoc would suffice!

}
}

/**
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While we here, possibly we can add a similar test in NioUdpClientTest too for completeness

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feel free to create a PR once this one is merged.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, will do, works!

@ibauersachs ibauersachs force-pushed the bugfix/selector-close branch from 0cda51d to 4b6761f Compare June 21, 2025 15:06
Closes #379
Closes #380

Co-authored-by: bhaveshthakker <bhaveshthakker111@gmail.com>
@ibauersachs ibauersachs force-pushed the bugfix/selector-close branch from 878da0d to 6e700d8 Compare June 28, 2025 15:21
@sonarqubecloud
Copy link

@ibauersachs ibauersachs merged commit 3efb25e into master Jun 28, 2025
26 of 27 checks passed
@ibauersachs ibauersachs deleted the bugfix/selector-close branch June 28, 2025 15:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ConcurrentModificationException in NioClient.processReadyKeys() due to concurrent selector modifications

3 participants