CLOSE_WAIT vs. TIME_WAIT

Just had an instance where we moved over an application from one server to another and there was a big jump in PHP versions from one server to another.  We noticed websites hanging on a particular page. By adding exit; to the code we determined it was a call to pgpcrypto that was causing the hanging on the page.

This lead to us noticed a bunch of CLOSE_WAITS on the system so hence the blog post.  I found a great explanation here (http://j2eedebug.blogspot.com/2008/12/difference-between-closewait-and.html) of what I am going to describe below.

What it basically says is a CLOSE_WAIT state is when a socket is waiting for an application to call close() on the socket.  Could be some type of error in the code.  A TIME_WAIT is a defined value on a system that just says wait 2*MSL (Maximum Segment Lifetime) of time and then close the connection.

Below is a display of the close steps for a TCP connection.

close_wait

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

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