Re: Listen port is still open after the process was killed (90 Views)
Reply
幼儿园
郭尚中_1
Posts: 107
Registered: ‎08-30-2004
Message 1 of 11 (90 Views)
Accepted Solution

Listen port is still open after the process was killed

We have a process which use TCP port xxxx as the listener port of service. Now we killed the process for some reason, but the port xxxx is still open when we monitor it using netstat command and we can not restart our daemon because of the opening port. We have to reboot our Tru64 unix. Does anyone has idea this problem. We don't want to reboot unix each time.
Version: Tru64 Unix V5.1A with PK6
Please use plain text.
Honored Contributor
Michael Schulte zur Sur
Posts: 4,040
Registered: ‎06-18-2003
Message 2 of 11 (90 Views)

Re: Listen port is still open after the process was killed

Hi,

can you post the netstat output?

greetings,

Michael
Please use plain text.
幼儿园
郭尚中_1
Posts: 107
Registered: ‎08-30-2004
Message 3 of 11 (90 Views)

Re: Listen port is still open after the process was killed

Thanks for your messages, I will post it here when this happen again.
Please use plain text.
Honored Contributor
Ralf Puchner
Posts: 1,657
Registered: ‎04-22-2003
Message 4 of 11 (90 Views)

Re: Listen port is still open after the process was killed

It seems an application programming problem. Sockets are not automatically closed it must be done programmatically. So please implement an kill-signal handler within your application.
Help() { FirstReadManual(urgently); Go_to_it;; }
Please use plain text.
幼儿园
郭尚中_1
Posts: 107
Registered: ‎08-30-2004
Message 5 of 11 (90 Views)

Re: Listen port is still open after the process was killed

Thanks for your messages, the application is apache, one important messages is we are using truss to trace the application during that times. I'm wondering if it can lead to the problem.
Please use plain text.
Honored Contributor
Venkatesh BL
Posts: 1,096
Registered: ‎09-12-2004
Message 6 of 11 (90 Views)

Re: Listen port is still open after the process was killed

Any other process using the same port still?. I am not sure how you can find this out...
Please use plain text.
Frequent Advisor
Don Ritchey
Posts: 29
Registered: ‎06-03-2003
Message 7 of 11 (90 Views)

Re: Listen port is still open after the process was killed

Obtain the freeware tool 'lsof' or 'List Open Files' from the Purdue University archives:
ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof

Build and install the tool, and run the command with the options:
lsof -i :xxxx
where xxxx is the port your program is using, and it will show any programs holding the port open. If you were using a debugger to look at the program, it may have held the port open after you were done looking at the program and did not exit from the debugger program.

Best wishes for solving the problem,

Don
Please use plain text.
Occasional Advisor
Hamel_2
Posts: 8
Registered: ‎12-20-2004
Message 8 of 11 (90 Views)

Re: Listen port is still open after the process was killed

Hello,

We had similar issue with envmond daemon, which can't start at boot time because its ports were used temporary by another process for outgoing connection.
To avoid listening/outgoing collision ports, we used 2 inet_sys parameters :
ipport_userreserved=60000
ipport_userreserved_min=32768
By default, Tru64 use port beginning at 1024 for outgoing connection.
Please use plain text.
Honored Contributor
Florian Heigl (new acc)
Posts: 1,546
Registered: ‎08-25-2003
Message 9 of 11 (90 Views)

Re: Listen port is still open after the process was killed

next time please look at the results of the following:

netstat -na | grep | grep WAIT

- I'd guess the port shows being in state FIN_WAIT_2.

I haven't yet found documentation on how this timeout is influenced on Tru64 [sysctl, ndd, whatever] and don't have access to my test system in the next time, so You might want to ask HP :)

(As a reference On HP-UX is goes by the name of 'tcp_fin_wait_2_timeout')
yesterday I stood at the edge. Today I'm one step ahead.
Please use plain text.
Honored Contributor
Florian Heigl (new acc)
Posts: 1,546
Registered: ‎08-25-2003
Message 10 of 11 (90 Views)

Re: Listen port is still open after the process was killed

See the following thread for Tru64 instructions:

http://groups.google.de/group/comp.unix.admin/browse_thread/thread/722503930360f000/b9ab87f6517d69f8...
yesterday I stood at the edge. Today I'm one step ahead.
Please use plain text.
Honored Contributor
Ralf Puchner
Posts: 1,657
Registered: ‎04-22-2003
Message 11 of 11 (88 Views)

Re: Listen port is still open after the process was killed

or use the search function and you will find out how to enable socket timeout and specifying timeout delay. Standard is 2 hours (as within other unix versions)
Help() { FirstReadManual(urgently); Go_to_it;; }
Please use plain text.
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation