05-21-07 06:22 AM
might be child process which inherit and didnt close the fh.
On May 21, 9:11 am, yong...@yahoo.com wrote:
> (This is not nessarily a programming question but hopefully somebody
> here
> knows the answer. The system is SunOS 5.8 Generic_108528-18 sun4u
> sparc SUNW,Sun-Fire-480R.)
> 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 <-- 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 <-- 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 <-- 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 -vall' 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.
>
> Yong Huang
[ Post a follow-up to this message ]
|