Repository navigation
Conversation
releasesThreadPorts counted every port name in the test process. Other suites run in parallel in the same process and create live ports of their own, so the growth crossed the threshold in 4 of 5 full `swift test` runs (101 to 111 against < 100) while passing on its own every time. A thread port that is not given back becomes a dead name once its thread ends, so count dead names only. Removing mach_port_deallocate from the sampler still fails the test (+299 dead names), and full runs now pass 5 of 5. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013tPsMTtKYpkDKdppcTMEgM
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
releasesThreadPortsinNectoProcessMetricsTestsflakes in fullswift testruns. It counts every Mach port name in the test process, and other suites running in parallel in the same process create live ports of their own, so the growth crosses the< 100threshold even though the sampler gives every thread port back. The test passes on its own every time.A thread port that is kept turns into a dead name when its thread ends, which is exactly what the test guards against. This change counts dead names only (
MACH_PORT_TYPE(MACH_PORT_RIGHT_DEAD_NAME), computed by hand because Swift does not import the macro). The threshold and loop are unchanged.Test Plan
On macOS 26.4, Xcode 26.6 (Swift 6.3.3), Apple Silicon:
swift test, 5 runs(portNameCount() - before → 104 / 111 / 101 / 102) < 100mach_port_deallocateremoved fromcpuAndThreadCount()(deadNameCount() - before → 299) < 100swift test --filter releasesThreadPortspasses before and after.🤖 Generated with Claude Code
https://claude.ai/code/session_013tPsMTtKYpkDKdppcTMEgM