GNU bug report logs -
#72092
popen creates "/dev/null" fds and never closes them
Previous Next
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
fix is attached
test code:
(use-modules (ice-9 ftw))
(use-modules (ice-9 popen))
(define (print-open)
(format #t "~a\n" (length (scandir "/proc/self/fd"))))
(let ((p (%make-void-port "rw")))
(print-open)
(parameterize ((current-output-port p) (current-input-port p) (current-error-port p))
(system* "ls"))
(close-port p)
(print-open))
(parameterize ((current-error-port (%make-void-port OPEN_BOTH)))
(while
#t
(close-pipe (open-pipe* OPEN_READ "free"))
(print-open)
(sleep 1)))
there's still a one-time increase in the file descriptors, but it seems unrelated. or at least much harder to find.
(by the way, ignoring current-output-port and using /dev/null is bad. it would be nice to open a pipe in that case and forward whatever the child writes to the scheme port.
but that would require a separate thread, and it may be impossible to do something like that for current-input-port)
[0001-fix-file-descriptor-leak-in-piped_process-system-pop.patch (text/x-patch, attachment)]
This bug report was last modified 259 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.