amphp / process

An async process dispatcher for Amp.
MIT License
233 stars 30 forks source link

Process leaks its IO streams #18

Closed brstgt closed 7 years ago

brstgt commented 7 years ago

If streams are not closed when child process is finished, the IO streams leak in the loop and may result in infinitely leaked FDs when loop is reset

trowski commented 7 years ago

The pipes cannot be closed immediately as data may remain on the pipe. @kelunik is correct, this PR breaks the basic-command.php example that uses echo "Hello, world!" as the command. The IO streams were never leaked, they were closed in the destructor. However for some reason I pulled out the resource and called fclose()… no idea why I did that. Updated in https://github.com/amphp/process/commit/c07c27f8825edec1c57f5fe03ea1830f415a886c.

brstgt commented 7 years ago

You are right. The streams don't leak if the process is dtored correctly. The underlying problem was the leaking of the whole process object. Thanks anyway!