René's URL Explorer Experiment


Title: Test Explorer always waits an extra ~5s per run: named-pipe "drain" deferred never resolves, falls back to RESULT_PIPE_DRAIN_TIMEOUT_MS · Issue #26071 · microsoft/vscode-python · GitHub

Open Graph Title: Test Explorer always waits an extra ~5s per run: named-pipe "drain" deferred never resolves, falls back to RESULT_PIPE_DRAIN_TIMEOUT_MS · Issue #26071 · microsoft/vscode-python

X Title: Test Explorer always waits an extra ~5s per run: named-pipe "drain" deferred never resolves, falls back to RESULT_PIPE_DRAIN_TIMEOUT_MS · Issue #26071 · microsoft/vscode-python

Description: Type: Performance Issue Behaviour I asked Claude (Anthropic's Claude Code) to investigate this and put together a minimal repro. The rest of this section is its summary. Every test run started from the Test Explorer / gutter "run" button...

Open Graph Description: Type: Performance Issue Behaviour I asked Claude (Anthropic's Claude Code) to investigate this and put together a minimal repro. The rest of this section is its summary. Every test run started from...

X Description: Type: Performance Issue Behaviour I asked Claude (Anthropic's Claude Code) to investigate this and put together a minimal repro. The rest of this section is its summary. Every test run started ...

Opengraph URL: https://github.com/microsoft/vscode-python/issues/26071

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Test Explorer always waits an extra ~5s per run: named-pipe \"drain\" deferred never resolves, falls back to RESULT_PIPE_DRAIN_TIMEOUT_MS","articleBody":"\nType: \u003cb>Performance Issue\u003c/b>\n\n\u003c!-- Please fill in all XXX markers -->\n# Behaviour\n\n> I asked Claude (Anthropic's Claude Code) to investigate this and put together a minimal repro. The rest of this section is its summary.\n\nEvery test run started from the Test Explorer / gutter \"run\" button takes about 5 seconds longer than the pytest subprocess itself needs. The Testing view's spinner keeps spinning for that extra ~5s after the actual test run has already finished, before the run can be started again.\n\nWith the Python extension's log level set to `Trace`, the `Python` output channel shows the same pattern on every single run (not intermittently):\n\n```\n15:35:34.037 [debug] Test run finished, subprocess closed.\n15:35:39.039 [debug] awaitDeferredWithTimeout: deferred did not settle within 5000ms; giving up and continuing.\n15:35:39.040 [debug] Finished running tests, ending runInstance.\n```\n\nThe pytest subprocess exits at `.037`, and exactly 5000ms later (`.039`) `awaitDeferredWithTimeout` gives up and the run is finally marked finished. This 5000ms gap is identical on every run.\n\nLooking at the bundled extension source (`out/client/extension.js`), the pytest execution adapter always does, in a `finally` block after the run:\n\n```js\nfinally { await awaitDeferredWithTimeout(deferred, RESULT_PIPE_DRAIN_TIMEOUT_MS) }\n```\n\nwhere `RESULT_PIPE_DRAIN_TIMEOUT_MS = 5000` is hardcoded (no user-facing setting), and:\n\n```js\nt.awaitDeferredWithTimeout = async function (e, t) {\n  let n;\n  try {\n    await Promise.race([\n      e.promise,\n      new Promise((e) => {\n        n = setTimeout(() => {\n          traceVerbose(`awaitDeferredWithTimeout: deferred did not settle within ${t}ms; giving up and continuing.`);\n          e();\n        }, t);\n      }),\n    ]);\n  } finally {\n    n && clearTimeout(n);\n  }\n};\n```\n\nThe `deferred` is only resolved from inside the results named-pipe wrapper's own `dispose()` callback (`startRunResultNamedPipe`, same file), which is expected to fire when the pipe reports a clean end-of-stream/drain. In this environment that resolution never arrives before the 5s timeout, so every run falls through to the \"give up and continue\" branch and eats the full 5 seconds on top of the real test time.\n\nOn the Python side (`python_files/vscode_pytest/__init__.py`), the writer end of the results pipe is only closed via:\n\n```python\natexit.register(lambda: __writer.close() if __writer else None)\n```\n\ni.e. it relies on full interpreter shutdown to close the pipe, rather than closing/flushing the connection proactively right after the last result is written. This looks like the likely reason the \"drain\" signal the extension is waiting on doesn't arrive in time, making the 5s timeout the common case rather than a rare fallback.\n\nFor a fast test suite (a few seconds or less), this hardcoded wait dominates the total run time and makes iterating on individual tests via the Test Explorer noticeably slower than running `pytest` directly from a terminal.\n\n## Steps to reproduce:\n\n1. Open a workspace with `python.testing.pytestEnabled: true` and at least one pytest test.\n2. Set the Python extension log level to `Trace` (Command Palette → `Developer: Set Log Level...` → `Python`).\n3. Run any test from the Testing view or the gutter icon.\n4. Watch the Testing view spinner and the `Python` output channel: the spinner keeps spinning for ~5s after \"Test run finished, subprocess closed.\" is logged, until `awaitDeferredWithTimeout` gives up.\n\n\u003c!--\n**After** creating the issue on GitHub, you can add screenshots and GIFs of what is happening. Consider tools like https://www.cockos.com/licecap/, https://github.com/phw/peek or https://www.screentogif.com/ for GIF creation.\n-->\n\n\u003c!-- **NOTE**: Please do provide logs from Python Output panel. -->\n# Diagnostic data\n\n\u003cdetails>\n\n\u003csummary>Output for \u003ccode>Python\u003c/code> in the \u003ccode>Output\u003c/code> panel (\u003ccode>View\u003c/code>→\u003ccode>Output\u003c/code>, change the drop-down the upper-right of the \u003ccode>Output\u003c/code> panel to \u003ccode>Python\u003c/code>)\n\u003c/summary>\n\n\u003cp>\n\n```\n2026-07-28 15:35:31.813 [debug] Starting Test Result named pipe\n2026-07-28 15:35:31.813 [debug] Test Results named pipe /run/user/1001/python-test-results-a573e256a741ea7b46bd connected\n2026-07-28 15:35:31.814 [debug] Executable path for pytest execution: /path/to/workspace/.venv/bin/python.\n2026-07-28 15:35:31.814 [info] arg: --rootdir already exists in args, not adding.\n2026-07-28 15:35:31.814 [info] Attempting to use temp directory for test ids file, file name: test-ids-1acf8ccdcb1412644b52.txt\n2026-07-28 15:35:31.828 [info] Environment variables set for pytest execution: PYTHONPATH=/path/to/.vscode/extensions/ms-python.python-2026.5.2026070801-linux-x64/python_files:./, TEST_RUN_PIPE=/run/user/1001/python-test-results-a573e256a741ea7b46bd, RUN_TEST_IDS_PIPE=/run/user/1001/test-ids-1acf8ccdcb1412644b52.txt\n2026-07-28 15:35:31.829 [info] Running pytest with arguments: /path/to/.vscode/extensions/ms-python.python-2026.5.2026070801-linux-x64/python_files/vscode_pytest/run_pytest_script.py --rootdir=/path/to/workspace for workspace /path/to/workspace\n2026-07-28 15:35:31.829 [info] > ./.venv/bin/python ~/.vscode/extensions/ms-python.python-2026.5.2026070801-linux-x64/python_files/vscode_pytest/run_pytest_script.py --rootdir=.\n2026-07-28 15:35:31.829 [info] cwd: .\n2026-07-28 15:35:33.544 [debug] Test Result named pipe /run/user/1001/python-test-results-a573e256a741ea7b46bd received data\n2026-07-28 15:35:34.037 [debug] Test run finished, subprocess closed.\n2026-07-28 15:35:39.039 [debug] awaitDeferredWithTimeout: deferred did not settle within 5000ms; giving up and continuing.\n2026-07-28 15:35:39.040 [debug] Finished running tests, ending runInstance.\n```\n\n\u003c/p>\n\u003c/details>\n\n**Environment**\n\n- VS Code Version: 1.130.0\n- Python Extension Version: 2026.5.2026070801\n- OS Version: Debian GNU/Linux 13 (trixie), kernel 6.12.96+deb13-amd64, x86_64\n- Python interpreter: 3.14.6 (CPython, uv-managed virtualenv, `.venv`)\n- Test framework: pytest 9.1.1\n\n\nExtension version: 2026.5.2026070801\nVS Code version: Code 1.130.0 (1b6a188127eeaf9194f945eb6eb89a657e93c54c, 2026-07-22T14:55:04Z)\nOS version: Linux x64 6.12.96+deb13-amd64\nModes:\n\n-   Python version (& distribution if applicable, e.g. Anaconda): 3.14.6\n-   Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Venv\n-   Value of the `python.languageServer` setting: None\n\n\u003cdetails>\n\u003csummary>User Settings\u003c/summary>\n\u003cp>\n\n```\n\nlanguageServer: \"None\"\n\ntesting\n• pytestArgs: \"\u003cplaceholder>\"\n• pytestEnabled: true\n\n```\n\u003c/p>\n\u003c/details>\n\n\u003cdetails>\n\u003csummary>Installed Extensions\u003c/summary>\n\n|Extension Name|Extension Id|Version|\n|---|---|---|\n|copilot-chat|Git|0.58.0|\n|debugpy|ms-|2026.7.12081008|\n|docker|doc|0.18.0|\n|js-debug|ms-|1.117.0|\n|js-debug-companion|ms-|1.1.3|\n|jsts-chat-features|Typ|0.0.4|\n|jupyter|ms-|2026.6.2026071501|\n|jupyter-keymap|ms-|1.1.2|\n|jupyter-renderers|ms-|1.3.2025062701|\n|python|ms-|2026.5.2026070801|\n|ruff|cha|2026.66.0|\n|ty|ast|2026.64.0|\n|vscode-containers|ms-|2.4.5|\n|vscode-cython|ktn|1.0.3|\n|vscode-js-profile-table|ms-|1.0.10|\n|vscode-python-envs|ms-|1.37.2026072401|\n\u003c/details>\n\u003cdetails>\n\u003csummary>System Info\u003c/summary>\n\n|Item|Value|\n|---|---|\n|CPUs|Intel(R) Core(TM) i7-10510U CPU @ 1.80GHz (8 x 3399)|\n|GPU Status|2d_canvas: enabled\u003cbr>GPU0: VENDOR= 0x8086 [Google Inc. (Intel)], DEVICE=0x9b41 [ANGLE (Intel, Mesa Intel(R) UHD Graphics (CML GT2), OpenGL ES 3.2 Mesa 25.0.7-2+deb13u1)], DRIVER_VENDOR=Mesa, DRIVER_VERSION=25.0.7 *ACTIVE*\u003cbr>Machine model name: \u003cbr>Machine model version: \u003cbr>direct_rendering_display_compositor: disabled_off_ok\u003cbr>gpu_compositing: enabled\u003cbr>multiple_raster_threads: enabled_on\u003cbr>opengl: enabled_on\u003cbr>rasterization: enabled\u003cbr>raw_draw: disabled_off_ok\u003cbr>skia_graphite: disabled_off\u003cbr>trees_in_viz: disabled_off\u003cbr>video_decode: enabled\u003cbr>video_encode: disabled_software\u003cbr>vulkan: disabled_off\u003cbr>webgl: enabled\u003cbr>webgpu: enabled\u003cbr>webgpu_on_vk_via_gl_interop: disabled_off\u003cbr>webnn: disabled_off|\n|Load (avg)|0, 0, 0|\n|Memory (System)|15.32GB (11.51GB free)|\n|Process Argv|.|\n|Screen Reader|no|\n|VM|0%|\n|DESKTOP_SESSION|gnome|\n|XDG_CURRENT_DESKTOP|GNOME|\n|XDG_SESSION_DESKTOP|gnome|\n|XDG_SESSION_TYPE|wayland|\n\u003c/details>\n\u003c!-- generated by issue reporter -->","author":{"url":"https://github.com/alihamdan","@type":"Person","name":"alihamdan"},"datePublished":"2026-07-28T14:07:53Z","url":"https://github.com/microsoft/vscode-python/issues/26071"}

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:c7fcb187-d4aa-cc8d-8281-cbc9c567aeca
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idC70A:21BD98:C33AB:F530B:6B00F6A3
html-safe-nonceff953b794f5be4a01908113611dd4b3d621ab46b327f665921b81f9a747868fd
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDNzBBOjIxQkQ5ODpDMzNBQjpGNTMwQjo2QjAwRjZBMyIsInZpc2l0b3JfaWQiOiI1NDk1OTI0MDY0NTMyODg3MjA0IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac4994c8b43aaf92b4a6fc24a451b2b272333e081183628361e5a759343c5c4b42
hovercard-subject-tagissue:4999478092
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/microsoft/vscode-python/26071/issue_layout
twitter:imagehttps://opengraph.githubassets.com/4647f2cdb9cd93ea3fd70483ac93e0d0b72110f054819f8e67ba5a356a75d0ab/microsoft/vscode-python/issues/26071
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/4647f2cdb9cd93ea3fd70483ac93e0d0b72110f054819f8e67ba5a356a75d0ab/microsoft/vscode-python/issues/26071
og:image:altType: Performance Issue Behaviour I asked Claude (Anthropic's Claude Code) to investigate this and put together a minimal repro. The rest of this section is its summary. Every test run started from...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamealihamdan
hostnamegithub.com
expected-hostnamegithub.com
None4ef498cbabcbe3c50befc7a5b743e7072ee770b4daf0e15e54801180d1fa91fc
turbo-cache-controlno-preview
go-importgithub.com/microsoft/vscode-python git https://github.com/microsoft/vscode-python.git
octolytics-dimension-user_id6154722
octolytics-dimension-user_loginmicrosoft
octolytics-dimension-repository_id106462765
octolytics-dimension-repository_nwomicrosoft/vscode-python
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forktrue
octolytics-dimension-repository_parent_id49946255
octolytics-dimension-repository_parent_nwoDonJayamanne/pythonVSCode
octolytics-dimension-repository_network_root_id49946255
octolytics-dimension-repository_network_root_nwoDonJayamanne/pythonVSCode
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
release9983dd5da06943f833c971dd5b6bc988e2858be5
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/microsoft/vscode-python/issues/26071#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2Fvscode-python%2Fissues%2F26071
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%2Fmicrosoft%2Fvscode-python%2Fissues%2F26071
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=microsoft%2Fvscode-python
Reloadhttps://github.com/microsoft/vscode-python/issues/26071
Reloadhttps://github.com/microsoft/vscode-python/issues/26071
Reloadhttps://github.com/microsoft/vscode-python/issues/26071
microsofthttps://github.com/microsoft
vscode-pythonhttps://github.com/microsoft/vscode-python
Codehttps://github.com/microsoft/vscode-python
Issues344 (344)https://github.com/microsoft/vscode-python/issues
Pull requests54 (54)https://github.com/microsoft/vscode-python/pulls
Discussionshttps://github.com/microsoft/vscode-python/discussions
Actionshttps://github.com/microsoft/vscode-python/actions
Wikihttps://github.com/microsoft/vscode-python/wiki
Security and quality2 (2)https://github.com/microsoft/vscode-python/security
Insightshttps://github.com/microsoft/vscode-python/insights
https://github.com/microsoft/vscode-python
New issuehttps://github.com/login?return_to=https://github.com/microsoft/vscode-python/issues/26071
New issuehttps://github.com/login?return_to=https://github.com/microsoft/vscode-python/issues/26071
#26082https://github.com/microsoft/vscode-python/pull/26082
Test Explorer always waits an extra ~5s per run: named-pipe "drain" deferred never resolves, falls back to RESULT_PIPE_DRAIN_TIMEOUT_MShttps://github.com/microsoft/vscode-python/issues/26071#top
#26082https://github.com/microsoft/vscode-python/pull/26082
https://github.com/alihamdan
Ali Hamdan (alihamdan)https://github.com/alihamdan
on Jul 28, 2026https://github.com/microsoft/vscode-python/issues/26071#issue-4999478092
github-actionshttps://github.com/apps/github-actions
triage-neededNeeds assignment to the proper sub-teamhttps://github.com/microsoft/vscode-python/issues?q=state%3Aopen%20label%3A%22triage-needed%22
on Jul 28, 2026https://github.com/microsoft/vscode-python/issues/26071#event-28602982741
vs-code-engineeringhttps://github.com/apps/vs-code-engineering
Eleanor Boyd (eleanorjboyd)https://github.com/eleanorjboyd
on Jul 28, 2026https://github.com/microsoft/vscode-python/issues/26071#event-28603617459
vs-code-engineeringhttps://github.com/apps/vs-code-engineering
triage-neededNeeds assignment to the proper sub-teamhttps://github.com/microsoft/vscode-python/issues?q=state%3Aopen%20label%3A%22triage-needed%22
on Jul 28, 2026https://github.com/microsoft/vscode-python/issues/26071#event-28603618463
Eduardo Villalpando Mello (edvilme)https://github.com/edvilme
Eleanor Boyd (eleanorjboyd)https://github.com/eleanorjboyd
on Nov 10, 2026https://github.com/microsoft/vscode-python/issues/26071#event-35741498354
Sign up for freehttps://github.com/signup?return_to=https://github.com/microsoft/vscode-python/issues/26071
Sign in to commenthttps://github.com/login?return_to=https://github.com/microsoft/vscode-python/issues/26071
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.