Skip to content

In Which Bagels Arises From TCP H*ll

March 12, 2015

The other day, prompted by Matt Millman‘s comments, I made a couple of changes to the Bagels server that seem to have greatly cleaned up the operation. Specifically:

  • when a session is established(status code 17) and there is no data, Sn_Rxsz=0, the program retries reading the data size for a couple of seconds before giving up and closing the session; and
  • If a status of SOCK_FIN_WAIT is seen the program waits several hundred ms to see if it clears before closing the socket

Both of these changes seem to be needed when a session is established from the public internet rather than on the local LAN.  I do see both situations using Chrome on the LAN but retries don’t help in either case: Sn_Rsz never fills in and SOCK_FIN_WAIT never goes away.

After making these changes, I opened up the game server to a couple of friends from the Cosmac Elf list to try remotely. In both cases they reported that the server never stalled or locked up the browser. I also tried it from safari, chrome, and IE from the library wifi and from safari on my phone. All of those were fine and i could see the changes taking effect in the log. I would swear that i never saw anything similar with the W5200 but i won’t be in a position to prove that for a few weeks.

At any rate, after a dozen or so games and a couple of undred pages served, the server seems quite usable now and I’m planning to open it up a bit wider on the weekend after making some minor functional changes.

Advertisements

From → web server

3 Comments
  1. inaxeon permalink

    This still looks like my own limited understanding of the problem 😉

    I wouldn’t ever declare anything fixed unless you’ve understood the problem to begin with.

    • Agreed: I’m very uncomfortable with the differences I see between browsers and connection types. Do NOT use my code in mission critical operations!

Trackbacks & Pingbacks

  1. Emergency Debugging Continued | olduino

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: