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

Akka.Remote - tcp socket address reuse - default configuration #2477

Closed
maxcherednik opened this issue Jan 22, 2017 · 5 comments · Fixed by #3674
Closed

Akka.Remote - tcp socket address reuse - default configuration #2477

maxcherednik opened this issue Jan 22, 2017 · 5 comments · Fixed by #3674

Comments

@maxcherednik
Copy link
Contributor

Due to the default setting, I was able to bind several instances to the same socket port on windows machine.

Should it be this way by default? Follow up: @Aaronontheweb

Enables SO_REUSEADDR, which determines when an ActorSystem can open

  # the specified listen port (the meaning differs between *nix and Windows)
  # Valid values are "on", "off" and "off-for-windows"
  # due to the following Windows bug: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4476378
  # "off-for-windows" of course means that it's "on" for all other platforms
  tcp-reuse-addr = on
@Aaronontheweb
Copy link
Member

Thanks for creating an issue out of this @maxcherednik.

I ran the test suite with this setting disabled (so, different from the current default) and everything passed, so I don't see any major issues there.

I think changing this default to off would be the "right" thing to do in the event that developers are accidentally setting themselves up for failure by having multiple Akka.NET processes all binding to the same ports by accident. This seems like a violation of the "fail fast" principle to me.

cc @akkadotnet/core any other thoughts on this?

@Aaronontheweb
Copy link
Member

Great SO on thread on the implications of this setting: http://stackoverflow.com/questions/14388706/socket-options-so-reuseaddr-and-so-reuseport-how-do-they-differ-do-they-mean-t

@Aaronontheweb
Copy link
Member

Makes me think we should probably just disabled it altogether.

@nvivo
Copy link
Contributor

nvivo commented Jan 24, 2018

On my tests, leaving tcp-reuse-addr = off may cause problems on Linux with .NET Core 2.

In most nodes I had a dynamic port selection for akka, so it selects the lowest free port in a range. That was used to have multiple services in the same server. I started noticing that after an app upgrade, the port in linux always changed even though it was the only process running with akka.

So, just for the sake of it I tried to let the port fixed, and after an app update, akka cannot bind to the same port for a few minutes, and the actorsystem keeps failing to start. That's probably related to the differences in the SO post, linux behaves differently from windows and really waits to cleanup the port before giving it to another app again.

There might be more to test, but just wanted to leave this experience here.

@Aaronontheweb Aaronontheweb added this to the 1.3.11 milestone Dec 14, 2018
Aaronontheweb added a commit to Aaronontheweb/akka.net that referenced this issue Dec 14, 2018
…euse-addr to default to 'off-for-windows'
@Aaronontheweb
Copy link
Member

Have a PR in-place which changes this to default to off-for-windows - which I think should be a happy medium.

Aaronontheweb added a commit that referenced this issue Dec 18, 2018
* close #3293 close #2477 - changed dot-netty.tcp.reuse-addr to default to 'off-for-windows'

* changed the default config setting to 'off-for-windows'

* Fixed RemoteConfigSpec
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants