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

[BUG] 'Address already in use' when restart after SocketIOClient.disconnect() and SocketIOServer.stop() #996

Open
yuan-java opened this issue Aug 4, 2024 · 2 comments

Comments

@yuan-java
Copy link

yuan-java commented Aug 4, 2024

  1. start server and a client
  2. socket IO connected
  3. call SocketIOClient.disconnect() and SocketIOServer.stop(), then close server
  4. start server again, then get the following issue:

Exception in thread "main" io.netty.channel.unix.Errors$NativeIoException: bind(..) failed: Address already in use

  1. wait for around 1 minute, restart again successfully

The issue happens from 1.x to latest 2.0.11.

Thanks

@birkoni5
Copy link

birkoni5 commented Aug 9, 2024

Does the solution from the issue help?

REUSE_PORT solves your problem, try this code when you start server

  val config = Configuration()
  config.setPort(port)
  val sockConfig = SocketConfig()
  sockConfig.setReuseAddress(true)
  config.setSocketConfig(sockConfig)
  val server = SocketIOServer(config)

@yuan-java
Copy link
Author

it works, thank you!

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

No branches or pull requests

2 participants