f



How can a new process use a used port?

I thought a new process could not use a TCP port already used by
another process. But on an Oracle database server, two processes both
open 1522 on the same IP. They were started completely independent of
each other (not from a common parent that opened port 1522 earlier).

#TNS listener:
$ ps -fp 17413
     UID   PID  PPID  C    STIME TTY      TIME CMD
  oracle 17413     1  0 01:49:00 ?        0:00 /export/home/oracle/
products/9205/bin/tnslsnr LISTENER -inherit
$ pfiles 17413
....
   9: S_IFSOCK mode:0666 dev:284,0 ino:14870 uid:0 gid:0 size:0
      O_RDWR FD_CLOEXEC
        sockname: AF_INET 0.0.0.0  port: 1522
....
  15: S_IFSOCK mode:0666 dev:284,0 ino:17586 uid:0 gid:0 size:0
      O_RDWR|O_NDELAY FD_CLOEXEC
        sockname: AF_INET 10.17.127.159  port: 1522
        peername: AF_INET 10.17.127.159  port: 45882

#Oracle dispatcher, which was started later:
$ ps -fp 17461
     UID   PID  PPID  C    STIME TTY      TIME CMD
  oracle 17461     1  0 01:56:52 ?        0:00 ora_d002_DEVL
$ pfiles 17461
....
  16: S_IFSOCK mode:0666 dev:284,0 ino:25387 uid:0 gid:0 size:0
      O_RDWR|O_NDELAY FD_CLOEXEC
        sockname: AF_INET 10.17.127.159  port: 1522
        peername: AF_INET 10.240.36.68  port: 3838

So how can 17461 obtain port 1522 without throwing an error like
"Address already in use"?

I also did truss on the new process (17461) when a client was
connecting to it. Its file descriptor 16 appeared all of a sudden:

17461:  getsockname(16, 0xFFFFFFFF7FFFD0AC, 0xFFFFFFFF7FFFD0BC, 1) = 0
17461:          AF_INET  name = 10.17.127.159  port = 1522

Thanks for any explanation.

(The system is SunOS 5.8 Generic_108528-18 sun4u sparc SUNW,Sun-
Fire-480R.)

Yong Huang

0
yong321 (411)
5/20/2007 10:02:06 AM
comp.unix.solaris 26025 articles. 2 followers. Post Follow

4 Replies
876 Views

Similar Articles

[PageSpeed] 54

netstat -an |grep LISTEN
lsof -i:1522
0
Alain
5/20/2007 5:14:51 PM
[yong321@yahoo.com]:
>
>   I also did truss on the new process (17461) when a client was
>   connecting to it. Its file descriptor 16 appeared all of a sudden:

sounds like the filedescriptor was passed over a socket from the real
listening daemon.
-- 
Kjetil T.
0
Kjetil
5/20/2007 6:47:27 PM
On May 21, 2:47 am, Kjetil Torgrim Homme <kjeti...@kaksi.ifi.uio.no>
wrote:
> [yong...@yahoo.com]:
>
>
>
> >   I also did truss on the new process (17461) when a client was
> >   connecting to it. Its file descriptor 16 appeared all of a sudden:
>
> sounds like the filedescriptor was passed over a socket from the real
> listening daemon.
> --
> Kjetil T.

Thanks, Kjetil. Can you explain? How was it done?

Yong Huang

0
yong321
5/21/2007 1:58:40 PM
[yong321@yahoo.com]:
>
>   > sounds like the filedescriptor was passed over a socket from the
>   > real listening daemon.
>   
>   Thanks, Kjetil. Can you explain? How was it done?

well, here's one explanation a quick search with Google found:

http://www.myelin.co.nz/post/2003/12/2/
-- 
Kjetil T.
0
Kjetil
5/21/2007 4:41:12 PM
Reply: