Skip to content
This repository was archived by the owner on Feb 10, 2023. It is now read-only.

Set SOCK_CLOEXOEC for sockets - #35

Merged
alexey-milovidov merged 1 commit into
ClickHouse:clickhousefrom
azat-ch:SOCK_CLOEXEC
Mar 13, 2021
Merged

alexey-milovidov merged 1 commit into
ClickHouse:clickhousefrom
azat-ch:SOCK_CLOEXEC

Conversation

@azat

@azat azat commented Mar 13, 2021 •

Copy link
Copy Markdown
Member

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

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
@alexey-milovidov
alexey-milovidov merged commit e48e67a into ClickHouse:clickhouse Mar 13, 2021
azat added a commit to azat/ClickHouse that referenced this pull request Mar 13, 2021
Found this in [1]:

    [Detaching after fork from child process 184152]
    ...
    Cannot get server pid with {}, got {}: {} lsof -i tcp:9000 -s tcp:LISTEN -Fp | awk '/^p[0-9]+$/{print substr($0, 2)}' b'301\n184152\n' invalid literal for int() with base 10: b'301\n184152\n'

But the major idea is that parent process should not export any file
descriptors to childrens, otherwise this may create security and other
breaches (like extra pipe endpoints, ...)

  [1]: https://clickhouse-test-reports.s3.yandex.net/21511/d7d9638ceb6bd702f34a88ee54f8f83197e90af5/stress_test_(address).html#fail1

Refs: ClickHouse/poco#35
@azat
azat deleted the SOCK_CLOEXEC branch April 4, 2022 13:23
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants