[issue47149] DatagramHandler doing DNS lookup on every log message

Bruce Merry report at bugs.python.org
Tue Mar 29 16:01:18 EDT 2022


Bruce Merry <bmerry at gmail.com> added the comment:

> Hmm. I'm not sure we should try to work around a bad resolver issue. What's your platform, and how did you install Python?

Fair point. It's Ubuntu 20.04, running inside Docker, with the default Python (3.8). I've also reproduced it outside Docker (again Ubuntu 20.04 with system Python). The TTL is 30s, so I'm not sure why systemd-resolved isn't caching it for messages logged several times a second.

Even if the system has a local cache though, it's not ideal to have logging block when the TTL expires, particularly in an event-driven (asyncio) service. Updating the address in a background thread while continuing to log to the old address might be better. But my use case is particularly real-time (even 10ms of latency is problematic), and maybe that shouldn't drive the default behaviour.

I blame the lack of standard POSIX functions for doing DNS lookups asynchronously and in a way that provides TTL information to the client.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue47149>
_______________________________________


More information about the Python-bugs-list mailing list