Command to release a port in AIX

Hi All,

I wanna know the command to release a particualr port in AIX machine without rebooting it.

# netstat -a | grep 7100
tcp4       0      0  loopback.7100      *.*                    LISTEN
#

In the above example, how to release the port 7100

Thanks in advance.

-Hemanshu

need a command for AIX 4.3.3. The rmsock works only for AIX 5L. Please let me know if there is any command to release a port in AIX 4.3.3

There would be a process that is listening on that port. Stopping that would be the first order of business.

It might also be that inetd is listening on that port and will fire up a process as specified in /etc/inetd.conf (does the name stay the same in AIX?).
In that case, find what process it is (usually from /etc/services - again confirm the name for AIX), then hash out the line referring to that process from /etc/inetd.conf. Send SIGHUP to inetd. That should do it.

If there isn't a process listening at all - or rather, there was a process, but it was killed or stopped uncleanly and didn't release the port, then just give it a few minutes. Connections to the port will drop once they timeout.

This is a customized application running on AIX, using this port and this is specified in /etc/services. When ever the application starts it looks into /etc/services uses the specified port to come into service, unfortunately due to some bug, the application hangs and few of its processes goes into exiting state:

# ps -eaf | grep -i exiting
root 10996 53590 1 10:46:01 pts/1 0:00 grep -i exiting
- 12472 - - - <exiting>
- 22580 - - - <exiting>
- 23476 - - - <exiting>
#

After this the port get stuck and when I restart the application, it fails to start saying that the port is in use. So I have to edit the /etc/services file and change the port to another one.

Since the application get hang then and there, now on the system there are lots of port which are stuck.

Also ports are not getting cleared up by itself, even after the timeout. It remains in LISTEN mode for ever, unless the system is rebooted.

I beleive if there is a way to clear up the exitung processes without rebooting the system, then it will clear up the system.

Is there anyway to kill the exiting processes ???

blowtorch is correct (by the way: yes, the filenames are correct for AIX too, regardless of the version). The problem is not a problem of the port, but a problem of the application. You will probably be able to remedy the problem by applying a healthy dose of "kill -9" onto the processes of your application.

Do something like the following:

ps -fe | grep exiting | while read junk PID junk ; do
     kill -9 $PID
done

I hope this helps.

bakunin

Here is some more details of the application. This application uses OpenSSH, to ftp files. When there are sftp failures, the sftp processes are becoming defunct. All the sftp are actually threads fork by the application. On investigation it is notice that some of the sftp processes which are defunct and the ssh process which is used by the application itself is going to exiting state. This doesnt happens immediately, after sftp failure, defunct processes are getting generated and also sometimes it gets cleared by itself, once it gets timed out. But after a long period say a 2 or 3 weeks, with many sftp failures in past, the processes goes to exiting state.

We are not able to kill -9 the exiting processes, it is not accepting any signals. Till now only way to clear them is to reboot the AIX box.

We are working on the remedy, but unable to understand how the processes are going to exiting state.

Has someone faced this issue where processes goes to exiting state, if yes how do we handle this situation ???