I have a problem that I am trying to hack around where I have lots of local port forwards getting sockets stuck in CLOSE_WAIT and lots of remote port forwards getting sockets stuck in FIN_WAIT2.
Currently I have no idea why this happens. Seems like a bug in ssh (running OpenSSH_6.6.1p1, OpenSSL 0.9.8j-fips 07 Jan 2009 on SuSE11 R4). However, I would like to simulate this so that I can write a socket smasher program.
I've tried writing python scripts that open sockets and die, I've tried opening them in threads and killing the calling app. I've tried establishing MySQL connections and letting them dangle (because this is what is causing the CLOSE_WAITs, but I can't replicate it) I could try 1000 other things, but none of them might cause this to happen. Both of the applications that are initiating the connections that get hung are closed source :( (one is Science Logic database connections, the other is some proprietary connection from a Cisco CSPC box)
So what do I need to do to get a socket stuck in CLOSE_WAIT and what do I need to do to get a socket stuck in FIN_WAIT2?