Skip to content

Close pipe fd when owner process exits#215

Open
hlindset wants to merge 2 commits into
akash-akya:masterfrom
hlindset:fix-pipe-fd-owner-exit
Open

Close pipe fd when owner process exits#215
hlindset wants to merge 2 commits into
akash-akya:masterfrom
hlindset:fix-pipe-fd-owner-exit

Conversation

@hlindset

Copy link
Copy Markdown

I encountered this issue while playing around with Vix streams: When halting a stream early, it seems like the target pipe fd can stay open until resource gc/cleanup.

I've added a regression test, asserting "Bad file descriptor" instead of :eagain after the owner process exits. The fix makes fd_rt_stop call close_fd on the NIF resource fd. I noticed there was an earlier commit 422fcfe aiming to fix a race condition, where close_fd was moved out of fd_rt_stop. Could that have been because the close_fd in fd_rt_stop was passed the call-by-value fd?

Note that I'm not a C/NIF expert, so I hope I haven't missed some lifecycle nuances here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant