I am on HPUX 11.0. I have a hung port, it is stuck in FIN_WAIT_2. Short of rebooting, how can I terminate the connection the system thinks still exists? I found a script online that uses adb but have not been able to get it to work. I am still open to using adb but have not been able to figure it out on my own, mostly becuase my background is Sun and HPUX is slightly different.
The usual reason for asking this question is that you want to restart a server but can't because you get a message "can't bind to port". There are adb scripts to close a FIN_WAIT_2 socket, I don't understand why you're having trouble with it. HP also has a program called ndd which can close a connection. But you shouldn't have to do this. Instead you address the real problem which is that the server has a bug that should be fixed.
There are two ways to ignore FIN_WAIT_2 sockets under unix. First, a program like inetd can do the bind at boot-up time and pass off new connections to the server as they arrive. Second, the server can simply set the SO_REUSEADDR option to indicate that it would prefer to ignore them.
You must have a server that does not want to run under inetd and it doesn't set SO_REUSEADDR. Ask whoever wrote the server to fix that. It takes one line of code to set SO_REUSEADDR and then you will have no more problem.
Thanks for the insight. I will see if I can get the program changed, which I am sure will take some time. In the mean time I will keep working the the adb script and check out ndd. If anyone has tips on adb troubleshooting, let me know.
I think ndd is for tuning only. You can use it to change timeout thresholds and things like that, but you can't use it to clear a port that has been left open to my knowledge. Anyone know how if this IS possible?
I think you are right. I thought there might be tuning parm to set the TTL on the connection, but all settings I could see are global so this would not help me. I think adb is the only way out. Guess I will keep searching for a working script and keep trying to tweak the one I have (which was created on HPUX 8 by the way, I have tried to update it for 11 but must be missing something in the adb command).
Remember that we are talking HP-UX here. HP's man page for ndd mentions "ndd -h unsupported". If you run:
ndd -h unsupported | grep disco
you will see:
tcp_discon - Terminate a TCP connection
tcp_discon_by_addr - Terminate a TCP connection
I have never had a TCP connection that I want to terminate, so I have never tried them. But I know several people who claim that they do work. Why are you saying that ndd can't do this? Did you guys try these and find that they don't work?