dns icon indicating copy to clipboard operation
dns copied to clipboard

Watch resolv.conf for changes

Open kelunik opened this issue 9 years ago • 10 comments

I think we should watch /etc/resolv.conf for changes or alternatively cache the config only for a certain amount of time.

kelunik avatar Jan 04 '17 13:01 kelunik

I'd opt for watching, but doing that AFAIK requires access to a syscall (i.e. fanotify/inotify etc.), which requires an extra ext.

We could do that optionally, but by default we should just cache it for a (globally) fixed time.

bwoebi avatar Jan 04 '17 14:01 bwoebi

Right. Additionally we can't do that on Windows.

kelunik avatar Jan 04 '17 14:01 kelunik

On Windows System.IO.FileSystemWatcher is a thing, it just needs to be available in an ext…

bwoebi avatar Jan 04 '17 14:01 bwoebi

@bwoebi We need to watch the registry, not the file system.

kelunik avatar Jan 04 '17 15:01 kelunik

auto-reload on changes should be a opt-in feature. people are used to re-start applications/shells etc. on such fundamental changes.

staabm avatar Jan 04 '17 15:01 staabm

@staabm They're not. /etc/resolv.conf usually takes effect immediately.

kelunik avatar Jan 04 '17 15:01 kelunik

@kelunik In that case you need RegistryKeyChangeEvent (you can access these WMI events via COM).

bwoebi avatar Jan 04 '17 15:01 bwoebi

@bwoebi in case it's available. But we can have these watchers as progressive enhancement at any time.

kelunik avatar Jan 04 '17 15:01 kelunik

This can be done manually now, but I guess we should still add it by default. What's a good interval for that?

https://github.com/amphp/dns/commit/cbe273c3d20c12bc07c5d734381f02ae3648e23d

kelunik avatar Jul 06 '17 19:07 kelunik

Without this feature services in kubernetes can't work with inside local network by dns. It fails with following reason:

In Rfc1035StubResolver.php line 193:

  All query attempts failed for {{ADDRESS}}-prod.svc.cluster.l
  ocal: Server returned error code: 3, Server returned error code: 3


In functions.php line 534:

  Multiple errors encountered; use Amp\MultiReasonException::getReasons() to
  retrieve the array of exceptions thrown

Sad but true.

UPD: Hm. Config reload does not help me. This error needs a new issue.

roquie avatar Apr 30 '20 11:04 roquie