René's URL Explorer Experiment


Title: `asyncio_websockets` uses a fixed port (8001) and fails with `EADDRINUSE` when two instances run concurrently · Issue #516 · python/pyperformance · GitHub

Open Graph Title: `asyncio_websockets` uses a fixed port (8001) and fails with `EADDRINUSE` when two instances run concurrently · Issue #516 · python/pyperformance

X Title: `asyncio_websockets` uses a fixed port (8001) and fails with `EADDRINUSE` when two instances run concurrently · Issue #516 · python/pyperformance

Description: asyncio_websockets uses a fixed port (8001) and fails with EADDRINUSE when two instances run concurrently Summary bm_asyncio_websockets/run_benchmark.py binds a hard-coded port 8001 for both the server and the client: async with websocke...

Open Graph Description: asyncio_websockets uses a fixed port (8001) and fails with EADDRINUSE when two instances run concurrently Summary bm_asyncio_websockets/run_benchmark.py binds a hard-coded port 8001 for both the se...

X Description: asyncio_websockets uses a fixed port (8001) and fails with EADDRINUSE when two instances run concurrently Summary bm_asyncio_websockets/run_benchmark.py binds a hard-coded port 8001 for both the se...

Opengraph URL: https://github.com/python/pyperformance/issues/516

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`asyncio_websockets` uses a fixed port (8001) and fails with `EADDRINUSE` when two instances run concurrently","articleBody":"# `asyncio_websockets` uses a fixed port (8001) and fails with `EADDRINUSE` when two instances run concurrently\n\n## Summary\n\n`bm_asyncio_websockets/run_benchmark.py` binds a hard-coded port `8001` for both\nthe server and the client:\n\n```python\nasync with websockets.server.serve(handler, \"\", 8001):\n    async with websockets.client.connect(\"ws://localhost:8001\") as ws:\n```\n\nThe default suite runs this benchmark only once, so the fixed port does not\nconflict in a normal sequential run. However, it makes the benchmark impossible\nto run concurrently with itself, and it also fails if an unrelated process is\nalready using port 8001.\n\nI hit this while running every pyperformance sub-item in parallel, one process\nper benchmark. Only one instance of `asyncio_websockets` is in the suite today,\nso the parallel run passed, but a second instance (CI sharding, a custom runner,\nor running the benchmark twice at the same time) fails immediately. This is the\nsame class of problem as #514 (`asyncio_tcp` / `asyncio_tcp_ssl` on port 8882),\nreported separately because this benchmark needs its own fix and testing.\n\n## How to reproduce the issue\n\nUsing the public `pyperformance` interface:\n\n```bash\n# Make sure the shared venv already exists (run the benchmark once).\npython -m pyperformance run -b asyncio_websockets -f -o /tmp/warmup.json\n\n# Now run two instances concurrently.\npython -m pyperformance run -b asyncio_websockets -f -o /tmp/ws1.json &\npython -m pyperformance run -b asyncio_websockets -f -o /tmp/ws2.json &\nwait\n```\n\nThe same thing happens if the benchmark script is invoked directly twice:\n\n```bash\nBENCH=$(python -c 'import os, pyperformance; print(os.path.join(\n    os.path.dirname(pyperformance.__file__),\n    \"data-files\", \"benchmarks\", \"bm_asyncio_websockets\", \"run_benchmark.py\"))')\n\npython \"$BENCH\" -f --output /tmp/ws1.json &\npython \"$BENCH\" -f --output /tmp/ws2.json &\nwait\n```\n\n## What you expected to happen\n\nBoth instances should complete successfully:\n\n- instance 1: `Mean +- std dev: ...`\n- instance 2: `Mean +- std dev: ...`\n\n## What actually happens\n\nOne of the two processes dies at server startup:\n\n```\nTraceback (most recent call last):\n  ...\n  File \".../bm_asyncio_websockets/run_benchmark.py\", line 38, in main\n    async with websockets.server.serve(handler, \"\", 8001):\n  ...\nOSError: [Errno 98] error while attempting to bind on address ('::', 8001, 0, 0):\n[errno 98] address already in use\n```\n\nDepending on which address family wins the race, the failing address can be\nreported as `('0.0.0.0', 8001)` or `('::', 8001, 0, 0)`. With `pyperformance run`\nthe failure is reported as:\n\n```\nERROR: Benchmark asyncio_websockets failed: Benchmark died\n```\n\nRunning `asyncio_websockets` on its own succeeds, which confirms the failure is\ncaused by the fixed port rather than by the websocket code path.\n\n## Environment\n\n- pyperformance `1.14.0` (main at `8a0713c`)\n- Python `3.16.0a2+dev` (64-bit), but the fixed port is not version-specific\n- `websockets==11.0.3` (the version pinned by the benchmark)\n- Linux 5.15, x86_64\n\n## Possible fix\n\nBind port `0` and read the actual port back from the listening socket:\n\n```diff\n-    async with websockets.server.serve(handler, \"\", 8001):\n-        async with websockets.client.connect(\"ws://localhost:8001\") as ws:\n+    async with websockets.server.serve(handler, \"127.0.0.1\", 0) as server:\n+        port = server.sockets[0].getsockname()[1]\n+        async with websockets.client.connect(f\"ws://127.0.0.1:{port}\") as ws:\n             await asyncio.gather(*[send(ws) for _ in range(100)])\n```\n","author":{"url":"https://github.com/sendaoYan","@type":"Person","name":"sendaoYan"},"datePublished":"2026-11-19T03:04:54Z","url":"https://github.com/python/pyperformance/issues/516"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:9048f530-45ad-89a7-91dc-873a65469ba7
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idB92A:1148D3:3500A93:43A61B7:6B01E935
html-safe-noncea4269850d8e4f34739fc43532f97405d9bec37bad74b9805d85c91b918a553f4
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCOTJBOjExNDhEMzozNTAwQTkzOjQzQTYxQjc6NkIwMUU5MzUiLCJ2aXNpdG9yX2lkIjoiNDU1NzEzMDU2ODIzOTgwMjY3NyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmacdcadb020aafe9a9b9a65abb58566f808d339cf79894054822e5381824c4762a9
hovercard-subject-tagissue:6481450013
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/pyperformance/516/issue_layout
twitter:imagehttps://opengraph.githubassets.com/20a107fd3057c17bd9aa782b6bb08f64fc3b6101d2d14f3a0227d84eed3d82e0/python/pyperformance/issues/516
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/20a107fd3057c17bd9aa782b6bb08f64fc3b6101d2d14f3a0227d84eed3d82e0/python/pyperformance/issues/516
og:image:altasyncio_websockets uses a fixed port (8001) and fails with EADDRINUSE when two instances run concurrently Summary bm_asyncio_websockets/run_benchmark.py binds a hard-coded port 8001 for both the se...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamesendaoYan
hostnamegithub.com
expected-hostnamegithub.com
None87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456
turbo-cache-controlno-preview
go-importgithub.com/python/pyperformance git https://github.com/python/pyperformance.git
octolytics-dimension-user_id1525981
octolytics-dimension-user_loginpython
octolytics-dimension-repository_id65949828
octolytics-dimension-repository_nwopython/pyperformance
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id65949828
octolytics-dimension-repository_network_root_nwopython/pyperformance
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release423dbb54c5e7bfecc838eb387c1435eb3d0e760d
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/python/pyperformance/issues/516#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fpyperformance%2Fissues%2F516
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
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
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://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
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fpyperformance%2Fissues%2F516
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=python%2Fpyperformance
Reloadhttps://github.com/python/pyperformance/issues/516
Reloadhttps://github.com/python/pyperformance/issues/516
Reloadhttps://github.com/python/pyperformance/issues/516
pythonhttps://github.com/python
pyperformancehttps://github.com/python/pyperformance
Codehttps://github.com/python/pyperformance
Issues53 (53)https://github.com/python/pyperformance/issues
Pull requests34 (34)https://github.com/python/pyperformance/pulls
Actionshttps://github.com/python/pyperformance/actions
Projectshttps://github.com/python/pyperformance/projects
Security and qualityhttps://github.com/python/pyperformance/security
Insightshttps://github.com/python/pyperformance/insights
https://github.com/python/pyperformance
New issuehttps://github.com/login?return_to=https://github.com/python/pyperformance/issues/516
New issuehttps://github.com/login?return_to=https://github.com/python/pyperformance/issues/516
#517https://github.com/python/pyperformance/pull/517
asyncio_websockets uses a fixed port (8001) and fails with EADDRINUSE when two instances run concurrentlyhttps://github.com/python/pyperformance/issues/516#top
#517https://github.com/python/pyperformance/pull/517
https://github.com/sendaoYan
sendaoYanhttps://github.com/sendaoYan
on Nov 19, 2026https://github.com/python/pyperformance/issues/516#issue-6481450013
#514https://github.com/python/pyperformance/issues/514
Sign up for freehttps://github.com/signup?return_to=https://github.com/python/pyperformance/issues/516
Sign in to commenthttps://github.com/login?return_to=https://github.com/python/pyperformance/issues/516
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.