Repository navigation
Conversation
HostsFileParser reloaded a changed file by clearing its maps in place and refilling them, while lookups read the maps without the lock. A lookup in that window found nothing, even for an entry present in both versions of the file. The first read had the same window: the maps were published before the file was parsed. Each read of the file now builds its own cache, published with a single volatile write and never cleared, and each lookup works on one snapshot. This also resets the "entire file parsed" flag per read, so a file that grows beyond dnsjava.hostsfile.max_size_bytes is searched again instead of reporting every uncached name as absent. Closes dnsjava#429
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #430 +/- ##
============================================
+ Coverage 71.42% 71.44% +0.01%
Complexity 3401 3401
============================================
Files 198 198
Lines 14031 14031
Branches 2245 2245
============================================
+ Hits 10022 10024 +2
+ Misses 3378 3376 -2
Partials 631 631 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…lling thread state The test paused the first read and slept in a loop until the concurrent lookup showed as BLOCKED. It now holds the read on a latch, checks that no cache has been published and that the concurrent lookup has not answered, then releases the read and expects both lookups to find the entry. A package-private hasCache(), next to cacheSize(), exposes the published state.
|
Member
|
Thanks, I'll look at it this week. Meanwhile, please rewrite the description - by hand. Please don't use AI for it. The changes are sensible at first glance, but the description is just a wall of text for me. |
Author
|
Updated |
This branch has not been deployed
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.



Closes #429.
Problem
Fix
Tests