question

Brent Batas (Lisk) avatar image
Brent Batas (Lisk) asked

Only one usage of each socket address error - custom game server

I'm debugging why there appears to be "ghost" servers that are sometimes started up - they seemingly start up properly, but nobody can connect to them.

After much debugging and logging, I found this error:

8/3/2018 10:51:19 PM: Caught first chance exception: System.Net.Sockets.SocketException (0x80004005): Only one usage of each socket address (protocol/network address/port) is normally permitted
   at System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot, SocketAddress socketAddress)
8/3/2018 10:51:19 PM: [DarkRift Fatal] System.Net.Sockets.SocketException (0x80004005): Only one usage of each socket address (protocol/network address/port) is normally permitted
   at System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot, SocketAddress socketAddress)
   at System.Net.Sockets.Socket.Bind(EndPoint localEP)
   at System.Net.Sockets.TcpListener.Start(Int32 backlog)
   at System.Net.Sockets.TcpListener.Start()
   at DarkRift.DarkRiftServer.FinishBootstrapping(IManualDataProcessor manualDataProcessor, Type[] forceLoadPlugins)

I can't think of why this would happen on only some servers (maybe 3% of servers), unless somehow the matchmaker tries to start two server instances on the same port. Is that a possibility?

Any tips on how I can log more information than this would be appreciated as well.

Edit: updated with longer stacktrace

Custom Game Servers
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Ben avatar image Ben commented ·

screen-shot-2018-08-03-at-61027-pm.png

Getting the exact same bug on our servers, starting early this week. Interestingly it seems to only occur in low port numbers, despite servers having a fairly even distribution across ports.

0 Likes 0 ·
brendan avatar image
brendan answered

It's looking like something in the latest Windows Update was the cause of this, though the mechanism of the failure is still being looked into.

7 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

brendan avatar image brendan commented ·

@Ben : The ports actually aren't evenly distributed. We assign the lowest port available to any new instance starting, so if an instance running 9000 goes away, the next instance to start would get 9000. So that's likely a red herring, in this case.

0 Likes 0 ·
brendan avatar image brendan commented ·

Okay, that should be resolved, now.

0 Likes 0 ·
Ben avatar image Ben brendan commented ·

Oh my mistake, I misunderstood my data. Thanks for the quick fix anyway!

0 Likes 0 ·
Brent Batas (Lisk) avatar image Brent Batas (Lisk) commented ·

I can confirm with pretty high confidence that the issue goes away after Matt reverted to the older VM. @Ben

0 Likes 0 ·
brendan avatar image brendan Brent Batas (Lisk) commented ·

Yes, it looks like the Windows Update change to fix another port issue they were seeing impacted this. We're looking into a way to work around this.

0 Likes 0 ·
Brent Batas (Lisk) avatar image Brent Batas (Lisk) brendan commented ·

Good to hear - can you possibly implement some improved error reporting on your guys' ends, to avoid this happening again? These outages significantly impacted our game's reputation especially because this happened during a sale. We had lots of complaints and were unable to resolve them in a timely manner.

0 Likes 0 ·
Show more comments
semon avatar image
semon answered

A SocketException is thrown by the Socket and Dns classes when an error occurs with the network. Most of the time these are connectivity issues due to different IP protocols (IPV4/IPV6) between the two server/computers trying to communicate or extra authentication rules setup on one of the computers for in/out connectivity. Ways to troubleshoot this SocketException are, check you have proper internet connection is there on your machine or not, and you are able to ping the remote server or not. Possible causes for the error:

  • You are using the wrong IP address.
  • You are using the wrong port.
  • Firewall blocking the connection.
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.