Skip to content
  • sheaf's avatar
    511b901a
    Don't attach finalizers to CommunicationHandles · 511b901a
    sheaf authored
    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.
    511b901a
    Don't attach finalizers to CommunicationHandles
    sheaf authored
    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.
Loading