Ticket #2835 (closed bug: wontfix)

Opened 3 years ago

Last modified 3 years ago

Handles leak to processes spawned by runInteractiveProcess

Reported by: sclv Owned by:
Priority: normal Milestone:
Component: libraries/process Version: 6.10.1
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Difficulty: Unknown
Test Case: Blocked By:
Blocking: Related Tickets:

Description

I believe this is related to  http://hackage.haskell.org/trac/ghc/ticket/2650 however this occurs on Linux and Windows both, as far as I can tell.

Attached is the test case. It opens a simple server which echoes everything to stdout with two exceptions: commands beginning with q signal "quit" and commands beginning with "l" signal launching a new process.

1) Launch sockLeak. Telnet to port 9020. Type in some junk. It will be echoed.
2) Type in "q". The connection will terminate.
3) Telnet in again. This time, type "l". Now type "q". The connection has not terminated.
4) This is clearly because the handle to the socket has gotten passed to the child process somehow.

Attachments

sockLeak.hs Download (1.4 KB) - added by sclv 3 years ago.

Change History

Changed 3 years ago by sclv

Changed 3 years ago by simonmar

  • status changed from new to closed
  • difficulty set to Unknown
  • resolution set to wontfix

Normally, only pipes created by the System.Process library are closed in child processes, all other FDs are inherited by default. You can request that all FDs are closed by using the new close_fds flag to createProcess; try this replacement for the line containing runProcess in your example:

  forkIO $ createProcess (proc (dir </> pn) ["arg"]){ close_fds=True } >> forever (threadDelay 100000)

This behaviour is fairly standard, it's what popen on Unix does, and it also follows the Python library.

Note: See TracTickets for help on using tickets.