The resolver does not re-read /etc/hosts upon change
See original GitHub issueExpected behavior
When /etc/hosts is changed, the netty resolver should re-read it.
Actual behavior
io.netty.resolver.DefaultHostsFileEntriesResolver parses /etc/hosts only once, upon creation.
Netty version
4.1.67
JVM version (e.g. java -version
)
any
OS version (e.g. uname -a
)
any
The WatchService (https://docs.oracle.com/javase/tutorial/essential/io/notification.html) can be used to monitor /etc/hosts and re-read it immediately after it is changed. The same Java API can be used in UnixResolverDnsServerAddressStreamProvider for re-reading /etc/resolv.conf. At the very least, /etc/hosts should be re-read every few minutes (like the current approach for /etc/resolv.conf).
Issue Analytics
- State:
- Created 2 years ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
How to reload /etc/hosts after editing in Linux?
You can restart the mentioned service by entering the following command in the command terminal. Any other issues related to the hosts' file...
Read more >After modifying /etc/hosts which service needs to be restarted?
For the most part etc/hosts changes should be recognized immediately. ... restart the DNS resolver it will pick up the newly-added/edited etc/hosts entries....
Read more >dnsmasq doesn't automatically reload when entry is added to ...
The thing is that in my project, the hosts will be changed like a few times per minute. This will make dnsmasq restart...
Read more >Why do changes to /etc/hosts take effect immediately?
It says: "When resolving a hostname, first read /etc/hosts file to lookup the hostname, if not found then run a DNS query, if...
Read more >How do I refresh the hosts file on OS X? - Super User
You don't need to. Simply sudo vim /etc/hosts , change what you need to change and go on. Your changes will be applied...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
There is already a pending PR for this: https://github.com/netty/netty/pull/11922
@bric3 I think we should just re-read after X seconds.