-
-
Notifications
You must be signed in to change notification settings - Fork 335
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
OTP: reuseaddr option is ignored on Windows #216
Comments
There has been some work done in OTP 25 and 26 around this, see the new Even leaving the |
As long as nobody complains and the behavior is correct moving forward, which sounds like it is, then there is no problem. |
Ah, I remember that view on things of yours from bygone times 😄 Good old times 👴 |
@juhlig / @essen I believe we're experiencing a problem that may be tangentially related to what you're saying but I'm struggling to connect the dots. After updating to OTP 26 the following ranch option fails to work with the @spec reuse_port() :: {:raw, any(), any(), any()} | nil
defp reuse_port do
case :os.type() do
{:unix, :linux} -> {:raw, 1, 15, <<1::32-native>>}
{:unix, :darwin} -> {:raw, 0xFFFF, 0x0200, <<1::32-native>>}
_ -> nil
end
end When switching back to the EDIT: For clarification this is for enabling SO_REUSEPORT on darwin/linux systems. |
Could be a regression or at least an unwanted side effect of the new developments. I would recommend writing a small snippet using |
@hazardfn What does "fail to work" mean, ie what exactly happens or does not happen when? |
@juhlig Sorry for being unclear, basically SO_REUSEPORT is never set as intended and you end up with This occurs when creating a child_spec through ranch and starting it as part of the application supervision tree with the raw option as specified above. Put another way in OTP 25 the |
Hm, does setting the |
Oh wait, what was I thinking... That option does not work with the |
You're right, same on Linux. I added it to erlang/otp#7764 (comment) |
I will do a small 2.2 release soon. Is there anything to be done for that release in Ranch relating to this ticket? |
I don't think there is anything to add right now 🤷♂️ FYI, status of erlang/otp#7764 is that the new options are not at all available for the socket backend right now (notices were put up in the docs), and regarding the raw option issue that @hazardfn pointed out, bmk just found out that they work as expected on 26.0 but not on 26.1 and will investigate. |
Nothing from me either 🤷♀️ I mean, we could do some fiddling with the default and disallowed listen options, like for Windows setting |
You could send a PR with a test case for this and it should be succeeding in about a week when CI recompiles OTP master. |
Sounds like
SO_REUSEADDR
on Linux is equivalent toSO_REUSE_ADDR
+SO_EXCLUSIVEADDR
on Windows. Might be worth patching OTP to support it.Alternatively the new
socket
NIF should be made to work properly with it from scratch. But since it wants to be low-level perhaps it wants both options exposed instead?The text was updated successfully, but these errors were encountered: