Skip to content

Stress-test FileHandle readabilityHandler teardown on subprocess pipes#5507

Draft
rintaro wants to merge 1 commit into
swiftlang:mainfrom
rintaro:filehandle-pipe-readabilityhandler-teardown-tests
Draft

Stress-test FileHandle readabilityHandler teardown on subprocess pipes#5507
rintaro wants to merge 1 commit into
swiftlang:mainfrom
rintaro:filehandle-pipe-readabilityhandler-teardown-tests

Conversation

@rintaro

@rintaro rintaro commented Jul 9, 2026

Copy link
Copy Markdown
Member

We're seeing crashes in _dispatch_event_loop_drain during shutting down clangd in SourceKit-LSP tests. swiftlang/sourcekit-lsp#2717 (comment)

Add two tests that exercise tearing down a subprocess's stderr Pipe whose read end has a readabilityHandler, mirroring how SourceKit-LSP reads a child process's stderr: the handler reads availableData and clears itself on EOF, then the process and pipe are torn down.

One test runs the spawn/teardown cycle sequentially; the other runs it concurrently and closes the read end before EOF, so the close races the dispatch read source's asynchronous cancellation.

This covers a teardown path that has intermittently crashed on Linux in _dispatch_event_loop_drain while draining a dangling epoll muxnote. The tests should complete without crashing.

Add two tests that exercise tearing down a subprocess's stderr `Pipe`
whose read end has a `readabilityHandler`, mirroring how SourceKit-LSP
reads a child process's stderr: the handler reads `availableData` and
clears itself on EOF, then the process and pipe are torn down.

One test runs the spawn/teardown cycle sequentially; the other runs it
concurrently and closes the read end before EOF, so the close races the
dispatch read source's asynchronous cancellation.

This covers a teardown path that has intermittently crashed on Linux in
`_dispatch_event_loop_drain` while draining a dangling epoll muxnote. The
tests should complete without crashing.
@rintaro rintaro requested a review from a team as a code owner July 9, 2026 23:40
@rintaro

rintaro commented Jul 9, 2026

Copy link
Copy Markdown
Member Author

@swift-ci Please test

@rintaro

rintaro commented Jul 10, 2026

Copy link
Copy Markdown
Member Author

@swift-ci Please test Linux

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant