amphp / dns

Async DNS resolution for PHP based on Amp.

Home Page:https://amphp.org/dns

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Watch resolv.conf for changes

kelunik opened this issue · comments

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

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.

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

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

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

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

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

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

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

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

cbe273c

commented

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.