Why is TCP Connection state not changing from CLOSE_WAIT to CLOSED

sockettcpipwindows-server-2008

I have a client server application running in:
Server: Windows server 2008 R2 [Standard]
Client: Windows XP SP3

Workflow:
Server listens for client connections at port YY.
Client connects to server at port YY.
Data gets transferred from Server to Client.
Server closes the socket ( with reuse option, TF_REUSE_SOCKET)
Client closes the socket.

Problem:
In normal scenarios when the data transfer is finished the server closes the socket and everything works fine.
But in scenarios when Client closes the socket first ( for cancelling the data transfer) then the socket state @ server changes to CLOSED_WAIT ( as server recieves FIN from client). At client side the socket state in FIN_WAIT_2.
This socket state remains forever. The sockets are not released at all.

The same application works fine if the server is also WindowsXP XP3.

IS there any settings in Windows2008 R2 which makes my application to not to release the socket ( or change the socket state from CLOSED_WAIT) ?

Note:
I configured [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip\Parameters]
TcpFinWait2Delay = 60
But of no use.

Best Answer

The client is not receiveing an ACK from the server for the FIN it sent to the server. I would recommend putting a packet capture on the client and the server to see what's happening.