Jump to content

Unhandled Exception Port Error


ESO223

Recommended Posts

So I tried to post a log of this, but my log was too big for paste2.org, so if need be I'll grab one when it happens again and the server hasn't been running for so long. Anyway, what I'm experiencing is this: Two or more users are logged into the server, both using remote access (not on the local network). At least one tries to use the Chromecast for watching media. Shortly after starting this the server crashes and throws the Unhandled Exception about port usage. I'm using standard port 8096 and am on the current 3.0.5518.7 build. Is this happening because there are multiple remote viewers? Is there a way to improve things from my end (with my router/network)? The other thing I've noticed is that when this happens I have to use the windows task manager to end ffmpeg.exe before the server will completely restart. Any thoughts would be great, open to trying all! I'll post a full log when I have one that's smaller in size.

Link to comment
Share on other sites

Wow, it took two months for this situation to come up. And you're the lucky first one. Unfortunately I have had difficulty in creating this scenario locally so that I can ensure the server handles it. 

 

What is happening is, the socket connection between server and client is failing with a ConnectionReset error. This happens due to an obscure bug in Windows socket implementation:

 

Read:

 

https://msdn.microsoft.com/en-us/library/system.net.sockets.socket.acceptasync(v=vs.110).aspx

 

 

 

The SocketAsyncEventArgs.Completed event can occur in some cases when no connection has been accepted and cause the SocketAsyncEventArgs.SocketError property to be set to ConnectionReset. This can occur as a result of port scanning using a half-open SYN type scan (a SYN -> SYN-ACK -> RST sequence). Applications using the AcceptAsync method should be prepared to handle this condition.

 

And here is the person who actually discovered the issue. He got Microsoft to acknowledge it, but sadly, not fix it:

 

http://stackoverflow.com/questions/8263267/why-does-system-net-sockets-socket-acceptasync-complete-with-connectionreset-aft
 

He says:

 

 

After playing around with this for a bit I have found that a single SYN -> SYN-ACK -> RST sequence will raise the SocketAsyncEventArgs.Completed event and cause the SocketAsyncEventArgs.SocketError property to become SocketError.ConnectionReset. It appears this is expected behavior but it's definitely a gotcha and should be documented better.

Anyone port scanning your server and doing a half-open SYN type scan will generate similar traffic and cause the same problem. To prevent denial of service vulnerabilities in the software, one should be handling this special condition.

 

So basically, we have to work around this bug and catch the failure and re-open the socket, which we are doing, but as I said, I haven't been able to artificially re-create it which means our attempts to handle the situation haven't been tested.

 

I'll make another attempt during this server development cycle. A faster solution for you will be to figure who or what is port scanning your server, and stop that from happening.

Link to comment
Share on other sites

Schucks, okay. I'll try a few different methods with the users who are logging in and see if we can limit it until then. I'll play around and see if I can find what is port scanning too.

Link to comment
Share on other sites

  • 4 weeks later...

I am too getting a lot of these errors :-( it only seems to happen when there are multiple users logging in at the same time.... the server can be up and running for days without use or any errors and then when you connect I get this error and have to log in on Teamviewer on my phone to acknowledge the error and restart the mediabrowser server, oops sorry Emby Server :-) My logs are attached if they help!

 

https://dl.dropboxusercontent.com/u/38473789/logs.zip

Link to comment
Share on other sites

jabbera

It as merged into dev github 12 days ago although I don't know when it was released as an auto update. The first beta includes it though.

Edited by jabbera
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...