Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

webplayer client will send FIN to server once a sending initialed

Discussion in 'Editor & General Support' started by hashtree, May 13, 2014.

  1. hashtree

    hashtree

    Joined:
    Mar 3, 2014
    Posts:
    1
    Hi,
    I got a really weird issue. Not sure is there anybody who met the similar one and got solution for it?

    Key words:
    Webplayer, MAC, Chrome, Firefox, Networking

    Background:
    It’s a networking game. The client to communicate with the server via the socket, and the reading part is based on socket async programming model.

    Observation:
    The client works fine when it is the first time to connect to server. After that, whatever I close the explorer and re-entering the game again or refresh the web page directly. The game shall be reloaded. However, it acts weird from now on. The client still can establish connection with server. But a TCP FIN will be sent by client to close the connection as long as a sending request initialed by higher layer logic.

    Interesting Points:
    1) It happens only on webplayer, and the game totally works fine in standalone distribute.
    2) It happens only on MAC. I have tried Chrome, Firefox and Safari, all of them got this problem.
    3) It happens only after re-entering/reload the game.
    4) It can be constantly reproduced as long as the Google Chrome Helper EH still present in Activity Monitor.
    5) If I manually kill the Google Chrome Helper EH process or wait about 5 minutes (it will quit by itself), then the game can get back to the “first time” connecting situation, works fine again.

    Suspect:
    1) There got some resources, which allocates by game but were not released correctly when game quit. But I suppose the Chrome/webplayer should force to release all the resource because I have closed the entire web page.
    2) Google Chrome Helper EH is waiting for MONO thread quit, and the MONO is waiting for its GC to release resource?
    3)Async read is delegate to MONO thread pool, but it doesn't release when closing the socket?

    Any help or discussing would be appreciated!
     
  2. Graham-Dunnett

    Graham-Dunnett

    Unity Technologies

    Joined:
    Jun 2, 2009
    Posts:
    4,287
    All of these sound plausible. Just because the window/tab closes doesn't mean the underlying system resources get freed up. It's highly likely that a socket is still open, and when the page refreshes the socket can't be re-opened. Maybe you actually get the old not-freed socket and the stack gets in a completely undeterminable state. (So you get a FIN because the server says, hey, you closed the socket, I told you it was closed, so why ask for more data?) I don't have any magic solution, but you sound totally on the right track.