From 8471965a88a5a0f457fa4010b51322836981733d Mon Sep 17 00:00:00 2001 From: Alek Kowalczyk Date: Fri, 17 Nov 2023 07:59:49 +0100 Subject: [PATCH 1/3] https://github.com/python/cpython/issues/112169 : Documented getaddrinfo/getnameinfo loop executor usage implications. --- Doc/library/asyncio-eventloop.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Doc/library/asyncio-eventloop.rst b/Doc/library/asyncio-eventloop.rst index ea1d146f06cf2b..960447326cc798 100644 --- a/Doc/library/asyncio-eventloop.rst +++ b/Doc/library/asyncio-eventloop.rst @@ -1147,6 +1147,13 @@ DNS Asynchronous version of :meth:`socket.getnameinfo`. +.. note:: + Both *getaddrinfo* and *getnameinfo* internally utilize their synchronous + versions through the loop's default thread pool executor. + When this executor is saturated, these methods may experience delays, + which can manifest as "DNS timeouts" in higher-level networking libraries. + To mitigate this, consider using a custom executor for other user tasks. + .. versionchanged:: 3.7 Both *getaddrinfo* and *getnameinfo* methods were always documented to return a coroutine, but prior to Python 3.7 they were, in fact, From 0cb5a0b0774e90db3f5e9e66b1623f257be52564 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Mon, 20 Nov 2023 15:46:48 -0800 Subject: [PATCH 2/3] Add suggestion to change default executor --- Doc/library/asyncio-eventloop.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Doc/library/asyncio-eventloop.rst b/Doc/library/asyncio-eventloop.rst index 960447326cc798..fad83a27c03522 100644 --- a/Doc/library/asyncio-eventloop.rst +++ b/Doc/library/asyncio-eventloop.rst @@ -1152,7 +1152,8 @@ DNS versions through the loop's default thread pool executor. When this executor is saturated, these methods may experience delays, which can manifest as "DNS timeouts" in higher-level networking libraries. - To mitigate this, consider using a custom executor for other user tasks. + To mitigate this, consider using a custom executor for other user tasks, + or setting a default executor with a larger number of workers. .. versionchanged:: 3.7 Both *getaddrinfo* and *getnameinfo* methods were always documented From 751c584194e7e102b35464fb6948a3aafa401870 Mon Sep 17 00:00:00 2001 From: Kumar Aditya Date: Mon, 24 Jun 2024 13:44:12 +0530 Subject: [PATCH 3/3] Update Doc/library/asyncio-eventloop.rst Co-authored-by: Carol Willing --- Doc/library/asyncio-eventloop.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/asyncio-eventloop.rst b/Doc/library/asyncio-eventloop.rst index fad83a27c03522..db216fe8e0baa4 100644 --- a/Doc/library/asyncio-eventloop.rst +++ b/Doc/library/asyncio-eventloop.rst @@ -1151,7 +1151,7 @@ DNS Both *getaddrinfo* and *getnameinfo* internally utilize their synchronous versions through the loop's default thread pool executor. When this executor is saturated, these methods may experience delays, - which can manifest as "DNS timeouts" in higher-level networking libraries. + which higher-level networking libraries may report as increased timeouts. To mitigate this, consider using a custom executor for other user tasks, or setting a default executor with a larger number of workers.