Skip to content
This repository was archived by the owner on Dec 21, 2020. It is now read-only.

Add idempotent close method#3

Open
jvansanten wants to merge 1 commit intokchmck:masterfrom
jvansanten:double-close-fds
Open

Add idempotent close method#3
jvansanten wants to merge 1 commit intokchmck:masterfrom
jvansanten:double-close-fds

Conversation

@jvansanten
Copy link

AioPipeStream.__del__() relies on os.close() raising OSError upon attempts to double-close a file handle. If someone calls os.pipe() between AioPipeStream.detach() and AioPipeStream.__del__(), however, a new file handle may be created with the same value, causing AioPipeStream.__del__() to happily close a different pipe that may still be in use. This can happen when multiple subprocesses are in flight at once. This PR adds close() method that explicitly invalidates the held file handle, avoiding random double closes.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant