Don't attach finalizers to CommunicationHandles
We are now careful to not attach any Handle finalizers when creating pipes for inter-process communication on Unix systems. Instead, the handles are closed manually. The finalizers were causing problems in situations such as the following: - the parent creates a new pipe, e.g. pipe2([7,8]), - the parent spawns a child process, and lets FD 8 be inherited by the child, - the parent closes FD 8 (as it should), - the parent opens FD 8 for some other purpose, e.g. for writing to a file, - the finalizer for the Handle wrapping FD 8 runs, closing FD 8, even though it is now in use for a completely different purpose. This commit does not include a test, as the above bug is a bit difficult to trigger.
Showing
- System/Process/CommunicationHandle.hs 13 additions, 0 deletionsSystem/Process/CommunicationHandle.hs
- System/Process/CommunicationHandle/Internal.hsc 74 additions, 27 deletionsSystem/Process/CommunicationHandle/Internal.hsc
- changelog.md 8 additions, 0 deletionschangelog.md
- process.cabal 1 addition, 1 deletionprocess.cabal
- test/process-tests.cabal 3 additions, 3 deletionstest/process-tests.cabal
Loading
Please register or sign in to comment