Skip to content

Don't share handle/fd to child process - #170

Merged
SergiusTheBest merged 1 commit into
SergiusTheBest:masterfrom
chenjianlong:master
Jun 15, 2020
Merged

Don't share handle/fd to child process#170
SergiusTheBest merged 1 commit into
SergiusTheBest:masterfrom
chenjianlong:master

Conversation

@chenjianlong

Copy link
Copy Markdown
Contributor

On Windows doesn't let you delete files that are currently opened by another process. So if you create a child process while a Parquet file is open, with the current code the file handle is inherited to the child process, and the parent process can't then delete the file after closing it without the child process terminating first.

By default, Win32 file handles are not inheritable (likely because of the aforementioned problems). Except for _wsopen_s, which tries to maintain POSIX compatibility.

This is a serious problem for us.

We would argue that specifying _O_NOINHERIT by default in the _WIN32 path is a sensible approach and would likely be the correct behaviour as it matches the main Win32 API.

On Linux, open with O_CLOEXEC (since Linux 2.6.23) prevents file descriptors from leaking to child processes.

@SergiusTheBest SergiusTheBest added this to the 1.1.6 milestone Jun 15, 2020
@SergiusTheBest
SergiusTheBest merged commit bb40e21 into SergiusTheBest:master Jun 15, 2020
@SergiusTheBest

Copy link
Copy Markdown
Owner

Good catch! Thank you!

SergiusTheBest added a commit that referenced this pull request Jun 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants