2

We have application that involves C++ socket server, Flash client that communicates with C++ server and Python socket server that gives crossdomain.xml to Flash client. C++ server calls REST operations and return the results the the Flash client. All of this is hosted on Linux 64bit server - Debian.

For some of our users we have a lots of "Connection reset by peer" when Game server tries to read from socket (on recv()). Flash policy server also have similar amount from "Connection reset by peer".

I'm looking for ideas, resources what is the reason about this problem. For sure this is not from server overload - what of users - sometimes is with 3 users, some times is with 300 users.

We tested on our private servers and the situation is the same.

What we've suspected to fix the problem:

  • Flash client problems to communicate with C++ server and over all with sockets.
  • Network problems
  • Some combination tcp options

What we've done:

  • Catch security and IO erros from the client. There we just log them :(

What we've think to do:

  • Change priority of the C++ server to -5 or -10 - I hope this can boost IO operations.

I know the reason for "Connection reset by pear" - I check lots of them in stackOverFlow and google for that - but I can't find way to overcome this issue.

tshepang
  • 12,111
  • 21
  • 91
  • 136
gsone
  • 1,188
  • 8
  • 25
  • 1
    Does this happen early in the life of the connection? (You never receive any data from the connection) Or does this happen to connections that have been working fine? (And you have received some data correctly.) Does it happen to connections in bursts? Or are they randomly distributed in time? – David Schwartz Feb 15 '12 at 16:22
  • I did something similar for a game site, but implemented the flash/server communication using plain simple XML. I can't help you with your problem though, just wondering why you didn't try a simpler solution,. – vulkanino Feb 15 '12 at 16:22
  • `Connection reset by pear` only happens on Apple devices – Lightness Races in Orbit Feb 15 '12 at 16:27
  • 1
    @David - from what we have seen it happens in the beginning of the connection and connections that working fine - from one point stop working fine. Connections are randomly distributed in time. – gsone Feb 15 '12 at 19:36

1 Answers1

2

"Connection reset by peer" has nothing to do with server overload, it's a message telling you that the remote client (or some network equipment between you and the client) actively closed down the network connection.

It may be a sign of network trouble (home gateways thinking the connection timed out or your own firewall deciding connections are idle and timing out) or, maybe more likely, the client crashing or the user just navigating away from the page so the Flash client closes.

I don't think you'll easily be able to diagnose the problem without input from people actually having trouble.

Joachim Isaksson
  • 176,943
  • 25
  • 281
  • 294
  • Hey, we are getting debug log from Flash client - Security exceptions there and a few IO error exceptions but not really useful to fix the problem. I'll check for reasons like "flash force close socket reasons". – gsone Feb 15 '12 at 21:11
  • @glg So the log shows no client crashes or navigations away from the page then? – Joachim Isaksson Feb 15 '12 at 21:16
  • There is no client crashes but we didn't log "navigation away from the client". However when we reproduce that several times - my flash client was on focus and I get connection reset by peer from C++ socket server but if there is navigation away from the client - socket will be closed? – gsone Feb 16 '12 at 08:04
  • @glg You'll get "Connection reset by peer" if the server sends data to the client, but the client (or some firewall/network equipment between you) considers the connection closed. Are you reproducing it with the client and server being on the same LAN? – Joachim Isaksson Feb 16 '12 at 08:55
  • yep, the reason is clear to me. Compere on send and recv we get more connection reset by peer on recv - for Socket server side. We was able to reproduce this only over the Internet but it took 3 days. On production we didn't get it all but other users get it. As for our logs in Socket server - everything seems ok for the user A, he use the service and gets connection reset by peer. After this he needs to reconnect. Flash client get security exception when userID is not avaiable - before initial connection to the socket server. – gsone Feb 16 '12 at 10:51