René's URL Explorer Experiment


Title: feat(net): off-loop DNS resolution so connecting doesn't freeze the event loop / UI by jnuyens · Pull Request #177 · MicroPythonOS/MicroPythonOS · GitHub

Open Graph Title: feat(net): off-loop DNS resolution so connecting doesn't freeze the event loop / UI by jnuyens · Pull Request #177 · MicroPythonOS/MicroPythonOS

X Title: feat(net): off-loop DNS resolution so connecting doesn't freeze the event loop / UI by jnuyens · Pull Request #177 · MicroPythonOS/MicroPythonOS

Description: Summary Opening a network connection briefly freezes the whole UI during the DNS lookup (worst for unreachable / non-existent hosts). Easy to reproduce by connecting to a random non-existent host (e.g. akhegfkfkqhskfhesbfkwlmd.com). Root cause asyncio.open_connection() calls socket.getaddrinfo() synchronously before its first yield (extmod/asyncio/stream.py -- the upstream source even has a # TODO this is blocking! there). On ESP32-S3 that blocking DNS call runs on the asyncio event-loop thread, which is also the thread that drives the LVGL UI via micropython.schedule(). So while getaddrinfo waits, the scheduler can't run, LVGL never ticks, and the UI is frozen for the full DNS duration. This is not an unfixable ESP-IDF limitation: lwIP DNS is async internally, and ESP32's getaddrinfo releases the GIL while it waits (ports/esp32/modsocket.c), so another _thread keeps running during the lookup. The fix is entirely at the Python layer. Fix New mpos/net/async_dns.getaddrinfo_async(): resolves DNS in a _thread worker (same pattern as audiomanager.py / wifi_service.py) and await-polls via TaskManager.sleep_ms(), so the event loop / UI keep ticking while DNS resolves. It does not import asyncio (honors the "only TaskManager imports asyncio" rule). aiohttp now resolves the host off-loop, then connects to the resolved IP with server_hostname=host so TLS SNI and cert validation still use the real hostname. DNS + connect run together under the existing request timeout. Testing tests/test_async_dns.py (network-free, deterministic): proves the loop keeps ticking while a 150 ms-blocking lookup runs, and that worker exceptions propagate. Regression: existing aiohttp-path tests still pass. Live-verified on the desktop simulator against a dead host: old path = 0 UI ticks during the lookup; new path = loop kept ticking the whole time. (On-device the difference is multi-second.) No new dependencies; ASCII-only; behavior unchanged for normal hosts.

Open Graph Description: Summary Opening a network connection briefly freezes the whole UI during the DNS lookup (worst for unreachable / non-existent hosts). Easy to reproduce by connecting to a random non-existent host (...

X Description: Summary Opening a network connection briefly freezes the whole UI during the DNS lookup (worst for unreachable / non-existent hosts). Easy to reproduce by connecting to a random non-existent host (...

Opengraph URL: https://github.com/MicroPythonOS/MicroPythonOS/pull/177

X: @github

direct link

Domain: github.com

route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:f4c69eb1-6b33-999c-1ec6-c47691315f6f
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idD606:1802DE:49C77D:695179:6A50FAC3
html-safe-nonced4028a8dfc631ee2e664e09a41eaf7f2d6dc977ffb4fe41626136f77ff9145dd
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENjA2OjE4MDJERTo0OUM3N0Q6Njk1MTc5OjZBNTBGQUMzIiwidmlzaXRvcl9pZCI6IjUyODYyNDExMTExMzU4MTIyOTEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmacd431b0d74763447297714f0fdb22ef57577528b263ca399555d0d81c00d828a8
hovercard-subject-tagpull_request:3950603572
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/MicroPythonOS/MicroPythonOS/pull/177/files
twitter:imagehttps://avatars.githubusercontent.com/u/3696148?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/3696148?s=400&v=4
og:image:altSummary Opening a network connection briefly freezes the whole UI during the DNS lookup (worst for unreachable / non-existent hosts). Easy to reproduce by connecting to a random non-existent host (...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None5266e58c17a510c403505cc811606465e90a881d2007ee7df1c4800d5c659838
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/MicroPythonOS/MicroPythonOS git https://github.com/MicroPythonOS/MicroPythonOS.git
octolytics-dimension-user_id213598128
octolytics-dimension-user_loginMicroPythonOS
octolytics-dimension-repository_id975472483
octolytics-dimension-repository_nwoMicroPythonOS/MicroPythonOS
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id975472483
octolytics-dimension-repository_network_root_nwoMicroPythonOS/MicroPythonOS
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release8d836581d020676cc0ef4a83cd2fe17e4af02c3d
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/MicroPythonOS/MicroPythonOS/pull/177/files#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FMicroPythonOS%2FMicroPythonOS%2Fpull%2F177%2Ffiles
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FMicroPythonOS%2FMicroPythonOS%2Fpull%2F177%2Ffiles
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=MicroPythonOS%2FMicroPythonOS
Reloadhttps://github.com/MicroPythonOS/MicroPythonOS/pull/177/files
Reloadhttps://github.com/MicroPythonOS/MicroPythonOS/pull/177/files
Reloadhttps://github.com/MicroPythonOS/MicroPythonOS/pull/177/files
Please reload this pagehttps://github.com/MicroPythonOS/MicroPythonOS/pull/177/files
MicroPythonOS https://github.com/MicroPythonOS
MicroPythonOShttps://github.com/MicroPythonOS/MicroPythonOS
Notifications https://github.com/login?return_to=%2FMicroPythonOS%2FMicroPythonOS
Fork 82 https://github.com/login?return_to=%2FMicroPythonOS%2FMicroPythonOS
Star 737 https://github.com/login?return_to=%2FMicroPythonOS%2FMicroPythonOS
Code https://github.com/MicroPythonOS/MicroPythonOS
Issues 23 https://github.com/MicroPythonOS/MicroPythonOS/issues
Pull requests 7 https://github.com/MicroPythonOS/MicroPythonOS/pulls
Discussions https://github.com/MicroPythonOS/MicroPythonOS/discussions
Actions https://github.com/MicroPythonOS/MicroPythonOS/actions
Projects https://github.com/MicroPythonOS/MicroPythonOS/projects
Security and quality 0 https://github.com/MicroPythonOS/MicroPythonOS/security
Insights https://github.com/MicroPythonOS/MicroPythonOS/pulse
Code https://github.com/MicroPythonOS/MicroPythonOS
Issues https://github.com/MicroPythonOS/MicroPythonOS/issues
Pull requests https://github.com/MicroPythonOS/MicroPythonOS/pulls
Discussions https://github.com/MicroPythonOS/MicroPythonOS/discussions
Actions https://github.com/MicroPythonOS/MicroPythonOS/actions
Projects https://github.com/MicroPythonOS/MicroPythonOS/projects
Security and quality https://github.com/MicroPythonOS/MicroPythonOS/security
Insights https://github.com/MicroPythonOS/MicroPythonOS/pulse
Sign up for GitHub https://github.com/signup?return_to=%2FMicroPythonOS%2FMicroPythonOS%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2FMicroPythonOS%2FMicroPythonOS%2Fissues%2Fnew%2Fchoose
ThomasFarstrikehttps://github.com/ThomasFarstrike
MicroPythonOS:mainhttps://github.com/MicroPythonOS/MicroPythonOS/tree/main
jnuyens:async-dns-off-loophttps://github.com/jnuyens/MicroPythonOS/tree/async-dns-off-loop
Conversation 5 https://github.com/MicroPythonOS/MicroPythonOS/pull/177
Commits 1 https://github.com/MicroPythonOS/MicroPythonOS/pull/177/commits
Checks 6 https://github.com/MicroPythonOS/MicroPythonOS/pull/177/checks
Files changed https://github.com/MicroPythonOS/MicroPythonOS/pull/177/files
Please reload this pagehttps://github.com/MicroPythonOS/MicroPythonOS/pull/177/files
feat(net): off-loop DNS resolution so connecting doesn't freeze the event loop / UI https://github.com/MicroPythonOS/MicroPythonOS/pull/177/files#top
Show all changes 1 commit https://github.com/MicroPythonOS/MicroPythonOS/pull/177/files
6ebd799 feat(net): resolve DNS off the event loop so connecting does not free… jnuyens Jun 28, 2026 https://github.com/MicroPythonOS/MicroPythonOS/pull/177/commits/6ebd799869ea1c1901522c744759ce491aff3bfc
Clear filters https://github.com/MicroPythonOS/MicroPythonOS/pull/177/files
Please reload this pagehttps://github.com/MicroPythonOS/MicroPythonOS/pull/177/files
Please reload this pagehttps://github.com/MicroPythonOS/MicroPythonOS/pull/177/files
__init__.py https://github.com/MicroPythonOS/MicroPythonOS/pull/177/files#diff-f03e4b1130b6809b1146395dbde1691b0ee4cc62be76b75ccfc8435654414dcc
async_dns.py https://github.com/MicroPythonOS/MicroPythonOS/pull/177/files#diff-961b16b1c17ad6604fc1c4e6163d4f2834a616eb0942e6fa3d9fd3b270429d3a
test_async_dns.py https://github.com/MicroPythonOS/MicroPythonOS/pull/177/files#diff-1efd3a95befdfd38c701eaf4ef59cf246fbd80844388350f103abb9b4181f44a
internal_filesystem/lib/aiohttp/__init__.pyhttps://github.com/MicroPythonOS/MicroPythonOS/pull/177/files#diff-f03e4b1130b6809b1146395dbde1691b0ee4cc62be76b75ccfc8435654414dcc
View file https://github.com/jnuyens/MicroPythonOS/blob/6ebd799869ea1c1901522c744759ce491aff3bfc/internal_filesystem/lib/aiohttp/__init__.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/MicroPythonOS/MicroPythonOS/pull/177/{{ revealButtonHref }}
https://github.com/MicroPythonOS/MicroPythonOS/pull/177/files#diff-f03e4b1130b6809b1146395dbde1691b0ee4cc62be76b75ccfc8435654414dcc
https://github.com/MicroPythonOS/MicroPythonOS/pull/177/files#diff-f03e4b1130b6809b1146395dbde1691b0ee4cc62be76b75ccfc8435654414dcc
https://github.com/MicroPythonOS/MicroPythonOS/pull/177/files#diff-f03e4b1130b6809b1146395dbde1691b0ee4cc62be76b75ccfc8435654414dcc
https://github.com/MicroPythonOS/MicroPythonOS/pull/177/files#diff-f03e4b1130b6809b1146395dbde1691b0ee4cc62be76b75ccfc8435654414dcc
internal_filesystem/lib/mpos/net/async_dns.pyhttps://github.com/MicroPythonOS/MicroPythonOS/pull/177/files#diff-961b16b1c17ad6604fc1c4e6163d4f2834a616eb0942e6fa3d9fd3b270429d3a
View file https://github.com/jnuyens/MicroPythonOS/blob/6ebd799869ea1c1901522c744759ce491aff3bfc/internal_filesystem/lib/mpos/net/async_dns.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/MicroPythonOS/MicroPythonOS/pull/177/{{ revealButtonHref }}
tests/test_async_dns.pyhttps://github.com/MicroPythonOS/MicroPythonOS/pull/177/files#diff-1efd3a95befdfd38c701eaf4ef59cf246fbd80844388350f103abb9b4181f44a
View file https://github.com/jnuyens/MicroPythonOS/blob/6ebd799869ea1c1901522c744759ce491aff3bfc/tests/test_async_dns.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/MicroPythonOS/MicroPythonOS/pull/177/{{ revealButtonHref }}
Please reload this pagehttps://github.com/MicroPythonOS/MicroPythonOS/pull/177/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.