Skip to content

Fatal error if TrackedFileDescriptor and TrackedDispatchIO have not been closed in deinit #72

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 12, 2025

Conversation

iCharlesHu
Copy link
Contributor

We cannot depend on calling .close() in deinit since it’s non-failable. As a result, Subprocess needs to manually call .close() at the conclusion of the read/write operation. fatalError in deinit to ensures the FileDescriptor/DispatchIO will not leak.

Resolves: #49

…een closed in deinit.

We cannot depend on calling .close() in deinit since it’s non-failable. As a result, Subprocess needs to manually call .close() at the conclusion of the read/write operation. fatalError in deinit to ensures the FileDescriptor/DispatchIO will not leak.
@iCharlesHu iCharlesHu requested review from parkera and itingliu June 12, 2025 04:58
@parkera
Copy link

parkera commented Jun 12, 2025

cc @FranzBusch @weissi

@iCharlesHu iCharlesHu merged commit c6c761e into swiftlang:main Jun 12, 2025
20 checks passed
@iCharlesHu iCharlesHu deleted the charles/surface-deinit-error branch June 12, 2025 17:39
@@ -632,26 +632,7 @@ internal struct TrackedFileDescriptor: ~Copyable {
return
}

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there's still this guard self.closeWhenDone here which is probably not intended as we're never closing here (which is great)

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.

Surface errors from closed file descriptors
3 participants