Skip to content

Conversation

@KushalP
Copy link
Contributor

@KushalP KushalP commented Oct 23, 2025

TaskQueue: Add destructor to close FDs, preventing resource leak

The Task class was missing a destructor to close pipe file descriptors when destroyed. This caused file descriptor exhaustion after ~2,187 test runs, making tests fail with POLLNVAL errors when the system ran out of resources.

This was found with:

./unittests/Basic/SwiftBasicTests --gtest_filter="TaskQueueTest.*" --gtest_repeat=1000

TaskQueueTest: Fix race condition in TaskSignalHandling test

Replace sleep with condition_variable synchronization to ensure the child PID is captured before attempting to kill it. This eliminates timing dependencies.

Replace `sleep` with `condition_variable` synchronization to ensure the child
PID is captured before attempting to kill it. This eliminates timing
dependencies.
The `Task` class was missing a destructor to close pipe file descriptors when
destroyed. This caused file descriptor exhaustion after ~2,187 test runs,
making tests fail with POLLNVAL errors when the system ran out of resources.

This was found with:
```
./unittests/Basic/SwiftBasicTests --gtest_filter="TaskQueueTest.*" --gtest_repeat=1000
```
@KushalP KushalP requested a review from DougGregor as a code owner October 23, 2025 12:01
@KushalP
Copy link
Contributor Author

KushalP commented Oct 23, 2025

@swift-ci Please test

@KushalP
Copy link
Contributor Author

KushalP commented Oct 23, 2025

@swift-ci Please test macOS platform

@glessard
Copy link
Contributor

@swift-ci please test Windows platform

@glessard glessard merged commit 4bc3d6a into swiftlang:main Oct 24, 2025
5 checks passed
@KushalP KushalP deleted the TaskQueueTest-fix-race branch October 24, 2025 18:17
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.

3 participants