Skip to content

[RFC] Set O_CLOEXEC - #9174

Merged
alexey-milovidov merged 1 commit into
ClickHouse:masterfrom
azat:O_CLOEXEC
Feb 18, 2020
Merged

alexey-milovidov merged 1 commit into
ClickHouse:masterfrom
azat:O_CLOEXEC

Conversation

@azat

@azat azat commented Feb 17, 2020

Copy link
Copy Markdown
Member

Changelog category (leave one):

  • Non-significant (changelog entry is not required)

Since clickhouse allows to execute user-specified command (i.e.
for dictionary loading), it is better not to expose them.

But there is something left for now:

- 10 -> socket:[14422712]
- 11 -> socket:[14422714]
- 12 -> anon_inode:[eventpoll]
- 13 -> anon_inode:[eventpoll]
- 14 -> anon_inode:[eventpoll]
- 15 -> socket:[14426310]
- 16 -> anon_inode:[eventpoll]
- 3 -> /proc/2739071/fd
- 6 -> socket:[14422708]
- 9 -> socket:[14422710]

And most of these (eventpoll) went from poco, for which O_CLOEXEC cannot
be passed
.

Since clickhouse allows to execute user-specified command (i.e.
for dictionary loading), it is better not to expose them.

But there is something left for now:
- 10 -> socket:[14422712]
- 11 -> socket:[14422714]
- 12 -> anon_inode:[eventpoll]
- 13 -> anon_inode:[eventpoll]
- 14 -> anon_inode:[eventpoll]
- 15 -> socket:[14426310]
- 16 -> anon_inode:[eventpoll]
- 3 -> /proc/2739071/fd
- 6 -> socket:[14422708]
- 9 -> socket:[14422710]

And most of these (eventpoll) went from poco, for which O_CLOEXEC cannot
be passed.

@alexey-milovidov alexey-milovidov left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok.

@alexey-milovidov

Copy link
Copy Markdown
Member

We can also close files in a loop after vfork and before exec but it can be tricky.

@azat

azat commented Feb 18, 2020

Copy link
Copy Markdown
Member Author

We can also close files in a loop after vfork and before exec but it can be tricky.

Indeed, and not only tricky, but also very slow

@alexey-milovidov
alexey-milovidov merged commit b688fc5 into ClickHouse:master Feb 18, 2020
@azat
azat deleted the O_CLOEXEC branch February 18, 2020 10:06
@abyss7 abyss7 added the pr-improvement Pull request with some product improvements label Feb 21, 2020
azat added a commit to azat-ch/poco that referenced this pull request Mar 13, 2021
azat added a commit to azat-ch/poco that referenced this pull request Mar 13, 2021
I've tried to do a normal interface, with ability to set it optinally,
but it is not that trivial, anyway creating socket w/o SOCK_CLOEXEC is
almost always an error (it is not a pipe/socketpair that may be used to
shared data between child and parent).

Follow-up for: ClickHouse/ClickHouse#9174
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-improvement Pull request with some product improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants