Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #930 +/- ##
=====================================
- Coverage 56% 56% -1%
=====================================
Files 89 89
Lines 9756 9764 +8
Branches 1817 1818 +1
=====================================
+ Hits 5472 5473 +1
- Misses 3908 3918 +10
+ Partials 376 373 -3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
…o-hub-does-not-run-as-documented
|
Yanks my previous comment here as the previous discussion has been resolved and so the comment is hidden... This sentence: I agree with you, and with your previous analyze, we can't runs blocking things in the event loop threads, else it would block all the rest. However, one thing related to the internal design of aiohttp bothers me. The DNS lookups made by aiohttp and that we can observe in the stack trace in the description of #929, rely of aiohttp's ThreadedResolver. The threaded resolver is the default used by aiodns:
This is a by design choice because its authors think that AsyncResolver of aiodns works in 99% of cases but sometimes demonstrate different behavior in very rare conditions (aio-libs/aiohttp#2237, aio-libs/aiohttp#559): aio-libs/aiohttp#2254. A comment in the
But, internally, this executor calls So, one thing is not clear for me. Why aiohttp should execute this coroutine in a threaded way? Also I didn't find where the resolver is launched. I found several reference to Leading us to the bug we observed and to this PR... In the example given in the issue at the origin of this PR, if one using the AsyncResolver it would surely have hidden this problem:
Fortunately the ThreadedResolver is the default one. |
|
Coroutines never run in a thread other than the main event loop. Blocking DNS lookups (and other blocking APIs) will run in a thread pool. |
|
To expand: |
asyncio.to_pool() work, with the same semantics as normal asyncioasyncio.to_thread() work, with the same semantics as normal asyncio
Yeah, that's my point... IMO, using the main event loop to run |
|
|
||
| ``concurrent.futures.thread`` just uses normal threads, not Eventlet's special threads. | ||
| Similarly, ``asyncio.to_pool()`` specifically requires regular blocking code, it won't work correctly with Eventlet code. | ||
| Similarly, ``asyncio.to_thread()`` specifically requires regular blocking code, it won't work correctly with Eventlet code. |
There was a problem hiding this comment.
Could be worth adding a link toward the official python doc https://docs.python.org/3/library/asyncio-task.html#asyncio.to_thread
It could be added with a follow up patch.
…rsion 0.36.1 0.36.1 ====== * [fix] eventlet.websocket is not always used from eventlet.wsgi, so do not assume eventlet.set_idle exists eventlet/eventlet#949 0.36.0 ====== * [fix] Make sure asyncio hub doesn't use greendns for asyncio DNS APIs eventlet/eventlet#938 * [fix] Make asyncio.to_thread work with the same semantics as normal asyncio eventlet/eventlet#930 * [fix] Refactor congruence checks based on assert at runtime eventlet/eventlet#932 * [tests] Run tests on macOS in CI, and some fixes to get it in reasonable state (#list eventlet/eventlet#934 * [fix] Fix wsgi.server shutdown for in-flight requests eventlet/eventlet#912 * [feature] Add debug convenience helpers - asyncio, threads eventlet/eventlet#925 * [fix] Handle errors better. eventlet/eventlet#923 (NEWS truncated at 15 lines) CVEs fixed in this build: CVE-2023-29483
Fixes #929