Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERL-1287: SO_REUSEPORT not working with socket backend #3093

Closed
OTP-Maintainer opened this issue Jun 19, 2020 · 2 comments
Closed

ERL-1287: SO_REUSEPORT not working with socket backend #3093

OTP-Maintainer opened this issue Jun 19, 2020 · 2 comments
Assignees
Labels
bug Issue is reported as a bug priority:medium team:PS Assigned to OTP team PS
Milestone

Comments

@OTP-Maintainer
Copy link

Original reporter: juhlig
Affected version: OTP-23.0.2
Fixed in version: OTP-23.1
Component: inet
Migrated from: https://bugs.erlang.org/browse/ERL-1287


On operating systems that support it, the SO_REUSEPORT option can be used to have multiple sockets listening on the same port. On Linux, for example, this can be enabled with the raw option \{raw, 1, 15, <<1:32>>} (different in other OSes).

 

While this works with the inet backend:
{code:java}
1> gen_tcp:listen(0, [{inet_backend, inet}, {port, 8888}, {raw, 1, 15, <<1:32>>}]).
{ok,#Port<0.8>}
2> gen_tcp:listen(0, [{inet_backend, inet}, {port, 8888}, {raw, 1, 15, <<1:32>>}]).
{ok,#Port<0.9>}
{code}
... it does not work when the socket backend is used:
{code:java}
1> gen_tcp:listen(0, [{inet_backend, socket}, {port, 8888}, {raw, 1, 15, <<1:32>>}]).
{ok,{'$inet',gen_tcp_socket,
             {<0.95.0>,{'$socket',#Ref<0.147054778.119668737.117952>}}}}
2> gen_tcp:listen(0, [{inet_backend, socket}, {port, 8888}, {raw, 1, 15, <<1:32>>}]).
{error,eaddrinuse}
{code}
@OTP-Maintainer
Copy link
Author

bmk said:

Hi,

It seems the raw option is not handled properly by gen_tcp when the socket backend is used.

/BMK

 

@OTP-Maintainer
Copy link
Author

raimo said:

Fixed for the upcoming maintenance release 23.1 as OTP-16743.

@OTP-Maintainer OTP-Maintainer added bug Issue is reported as a bug team:PS Assigned to OTP team PS priority:medium labels Feb 10, 2021
@OTP-Maintainer OTP-Maintainer added this to the OTP-23.1 milestone Feb 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue is reported as a bug priority:medium team:PS Assigned to OTP team PS
Projects
None yet
Development

No branches or pull requests

2 participants