Operating System - HP-UX
1833803 Members
2346 Online
110063 Solutions
New Discussion

Re: port is not released properly when server application is down

 
xiaoqing
Occasional Contributor

port is not released properly when server application is down

We have a server application running on HP-UX 11. The client on solaris 6, the network protocol is tcp/ip, programming with socket.

This application has run smoothly for long time, but recently, odd things happens. Some time we bring down the server, wait 5 miutes, but cannot restart it because there is an error "The port xxx is being used".

We have check system by netstat, this port is not there, and no other application use this port. We also check our client application is not running, and no connection to the server on this port.

appreciated if anybody can help me.
4 REPLIES 4
Michael Tully
Honored Contributor

Re: port is not released properly when server application is down

You should probably have a look at utilising 'lsof'. You can get a copy from here, ready to install using 'swinstall'.
http://hpux.cs.utah.edu/hppd/hpux/Sysadmin/lsof-4.61/

Here's how to use it.

To which files are open for a given process id (pid)

# lsof -p

To see all the open files associated with a particular command.

# lsof -c midaemon

User name

# lsof -u
# lsof -u

processes being used via a socket.

# lsof -i tcp:23
# lsof -i udp:123
Anyone for a Mutiny ?
T G Manikandan
Honored Contributor

Re: port is not released properly when server application is down

As Micheal suggested you have to use lsof to find the port usage.

you can get the lsof for 64 bit from
ftp://ftp.fu-berlin.de/pub/unix/tools/lsof/binaries/hpux/B.11.00/vxfs/64/9000_800/

Thanks

MANOJ SRIVASTAVA
Honored Contributor

Re: port is not released properly when server application is down

Hi


the trick is getting 64 bit binary version of lsof from the site:

http://ftp.cerias.purdue.edu/pub/tools/unix/sysutils/lsof/



download and run like

lsof | grep the port no the app is saying then u can go and kill the processe associated with it



Manoj Srivastava

rick jones
Honored Contributor

Re: port is not released properly when server application is down

it seems _very_ odd that you would have a failure like that and not have anything appear in netstat.

you might try taking a tusc trace of the startup of the server and just make sure that it is indeed failing on a bind() call, and also make sure that it is making a setsockopt() call to set SO_REUSEADDR.

tusc from ftp.cup.hp.com under dist/networking/tools/

if the server deamonizes, make sure you set tusc to follow forks. also, you should probably do a verbose trace (-v)

of course, the usual song and dance about being up on the latest Transport patches applies :)
there is no rest for the wicked yet the virtuous have no pillows