cancel
Showing results for 
Search instead for 
Did you mean: 

Socket permission issue

Jerome C
Occasional Advisor

Socket permission issue

Hello Everyone,

System HP IA 11.31
I am currently trying to run a process on a itanium box and get an error message as follow:

connect to /tmp/SocketStream.23451 failed error=Connection refused

The file is created under /tmp with a size of 0, as well permissions sounds ok (srwxsrwxsrwx) and owner is the user the process was run with.

In the ipcs the process appears with a "no-entry" for the D-TIME field.

Any help is welcome

Thanks for your help

Jerome

14 REPLIES
Laurent Menase
Honored Contributor

Re: Socket permission issue

usually just means that server side socket is not listening.
Jerome C
Occasional Advisor

Re: Socket permission issue

Thanks Laurent,


Definitely, problem is that the command i run should open the socket.

:(

Thanks

Jerome
Laurent Menase
Honored Contributor

Re: Socket permission issue

you need to find out server side socket owner process if you don't know it( with lsof for instance) - or may be it is process pid 23451
then tusc it to check it is well configured as a AF_UNIX/SOCK_STREAM and that bind() and listen() have been called on that socket.
Laurent Menase
Honored Contributor

Re: Socket permission issue

you can also try a netstat -an |grep SocketStream.23451
Jerome C
Occasional Advisor

Re: Socket permission issue

Thanks Laurent for precious informations.

FYI, i restarted process and bind to 9008.
I have been issuing the command you sent and can see the socket as follow in the netstat -an output:

e00000040f04e100 stream 0 0 e000000374c80380 0 0 0 /tmp/SocketStream.9008
e00000040f04e400 stream 90 0 0 e00000036ed09b80 0 0 /tmp/SocketStream.9008

I am also able to connect using "telnet localhost 9008" also using IP adress of server.

I have not access to tusc or lsof on this machine.


Thanks

Jerome



Laurent Menase
Honored Contributor

Re: Socket permission issue

telnet uses AF_INET socket and not AF_UNIX socket
so your telnet localhost 9008 connect to a socekt bound on AF_INET and not that /tmp/SockStream.9008

without lsof or tusc you won't make much progress.
Jerome C
Occasional Advisor

Re: Socket permission issue

Hi Laurent,

Thanks again.
Last lines of lsof are giving the following, user1 is the user i spawn process with and Program1 is the name of the process ran:
Program1 4163 user1 4u REG 64,0x30003 40960 65889 /oracle/product/11.1.0/db_1/rdbms/mesg/diaus.msb
Program1 4163 user1 5u REG 64,0x30003 25600 65970 /oracle/product/11.1.0/db_1/rdbms/mesg/ocius.msb
Program1 4163 user1 6u IPv6 0xe0000003763d2380 0t0 UDP [::1]:56386 (Idle)
Program1 4163 user1 7u IPv4 0xe00000036cb19d00 0t6034 TCP Machine1:50538->Machine1:1530 (ESTABLISHED)
Program1 4163 user1 8u IPv4 0xe0000003aed35a00 0t0 TCP *:* (IDLE)
Program1 4163 user1 9u REG 64,0x10001 608 90505 /usr/app/Program1/Program1ent.4163.10092916
Program1 4163 user1 10u IPv4 0xe000000376386380 0t0 TCP *:9008 (LISTEN)
Program1 4163 user1 11u unix 64,0x4 0t0 947 /tmp/SocketStream.9008 (0x6c85a980)
Program1 4163 user1 12u unix 0x682c4380 0t90 ->0xeb92d400

Thanks for your help

Jérôme
Laurent Menase
Honored Contributor

Re: Socket permission issue

Are you using RBAC/containment?
are you sure of your program which tries to connect using AF_UNIX sockets?-
if you have tusc,
use "tusc -v -E" of your program to understand what can happen to your socket.

If it is not an application you will probably need to contact HP support.
Jerome C
Occasional Advisor

Re: Socket permission issue

Hi Laurent,

i ran tusc and get the following segment:

st_dev: 64 0x000003
st_ino: 1872
st_mode: S_IFREG|0444
st_nlink: 1
st_rdev: 0 0x000000
st_size: 8
st_blksize: 8192
st_blocks: 8
st_uid: 2
st_gid: 2
st_atime: Thu Sep 30 09:31:04 2010
st_mtime: Mon Aug 23 13:53:40 2010
st_ctime: Mon Aug 23 13:53:40 2010
read(10, 0x6000000000192f50, 8) .................................................................. [entry]
read(10, "G M T 0 B S T \n", 8) .................................................................. = 8
close(10) ........................................................................................ [entry]
close(10) ........................................................................................ = 0
open(0x600000000002abe0, O_WRONLY|O_APPEND|O_CREAT, 0666) ........................................ [entry]
open("./DConfigAgent.29605.10093009", O_WRONLY|O_APPEND|O_CREAT|0x800, 0666) ..................... = 10
write(10, 0x600000000029e410, 143) ............................................................... [entry]
write(10, "| 2 0 1 0 - 0 9 - 3 0 T 0 9 : 3 ".., 143) ............................................. = 143
brk(0x60000000002c0000) .......................................................................... [entry]
brk(0x60000000002c0000) .......................................................................... = 0
utssys(0x9fffffffbf7df4f0, 49, 5) ................................................................ [entry]
utssys(0x9fffffffbf7df4f0, 49, 5) ................................................................ = 0
arg: "Machine1"
socket(AF_UNIX, SOCK_STREAM, 0) .................................................................. [entry]
socket(AF_UNIX, SOCK_STREAM, 0) .................................................................. = 11
connect(11, 0x9fffffffffffd400, 94) .............................................................. [entry]
sin_family: AF_UNIX
sun_path: /tmp/SocketStream.9008
connect(11, 0x9fffffffffffd400, 94) .............................................................. ERR#239 ECONNREFUSED
sin_family: AF_UNIX
sun_path: /tmp/SocketStream.9008
close(11) ........................................................................................ [entry]
close(11) ........................................................................................ = 0
gettimeofday(0x9fffffffffffd1b0, NULL) ........................................................... [entry]
gettimeofday(0x9fffffffffffd1b0, NULL) ........................................................... = 0
open(0xc00000000025b560, O_RDONLY, 045000) ....................................................... [entry]
open("/etc/default/tz", O_RDONLY|0x800, 045000) .................................................. = 11
fstat(11, 0x9fffffffffffce50) .................................................................... [entry]
fstat(11, 0x9fffffffffffce50) .................................................................... = 0

Thanks

Jerome

Laurent Menase
Honored Contributor

Re: Socket permission issue

your program looks ok, so things need to be look on server side,
- tusc from start is probably difficult


Also is it the first time you start your program that it fails or is it after some time?



You would probably gain some time contacting hp support. - some internal private tools can give informations about listening socket status.


Laurent Menase
Honored Contributor

Re: Socket permission issue

in fact it can happen also if the listen queue of the server process is full, or if the server called shutdown() over the listening socket.
Jerome C
Occasional Advisor

Re: Socket permission issue

Thanks Laurent,

there is a part of the tusc as follow, can the unlik be the cause?

[12900] socket(AF_INET, SOCK_STREAM, 0) ............................................................................................................................................. = 11

[12900] setsockopt(11, SOL_SOCKET, SO_REUSEADDR, 0x9fffffffffffe3b0, 4) ............................................................................................................. = 0

*optval: 0x1

[12900] sigvector(SIGPIPE, 0x9fffffffffffe390, 0x9fffffffffffe3a0) .................................................................................................................. = 0

vec.sv_handler: SIG_IGN

vec.sv_mask: EMPTY SET

vec.sv_flags: SV_RESETHAND

ovec.sv_handler: SIG_IGN

ovec.sv_mask: SIGHUP|SIGINT|SIGQUIT|SIGTRAP|SIGEMT|SIGPIPE|SIGALRM|SIGTERM|SIGUSR1|SIGCLD|SIGPWR|SIGVTALRM|SIGPROF|SIGIO|SIGWINCH|SIGTSTP|SIGCONT|SIGTTIN|SIGTTOU|SIGURG|SIGLOST|_SIGDIL

ovec.sv_flags: 0

[12900] bind(11, 0x9fffffffffffe3d0, 16) ............................................................................................................................................ = 0

sin_family: AF_INET

sin_port: 9008

sin_addr.s_addr: 0.0.0.0

[12900] fcntl(11, F_GETFD, 0) ....................................................................................................................................................... = 0

[12900] fcntl(11, F_SETFD, 1) ....................................................................................................................................................... = 0

[12900] fcntl(11, F_GETFL, 0) ....................................................................................................................................................... = 2

[12900] fcntl(11, F_SETFL, 65538) ................................................................................................................................................... = 0

[12900] listen(11, 100) ............................................................................................................................................................. = 0

[12900] socket(AF_UNIX, SOCK_STREAM, 0) ............................................................................................................................................. = 12

[12900] setsockopt(12, SOL_SOCKET, SO_REUSEADDR, 0x9fffffffffffe374, 4) ............................................................................................................. = 0

*optval: 0x1

[12900] sigvector(SIGPIPE, 0x9fffffffffffe350, 0x9fffffffffffe360) .................................................................................................................. = 0

vec.sv_handler: SIG_IGN

vec.sv_mask: EMPTY SET

vec.sv_flags: SV_RESETHAND

ovec.sv_handler: SIG_IGN

ovec.sv_mask: EMPTY SET

ovec.sv_flags: SV_RESETHAND

[12900] unlink("/tmp/SocketStream.9008") ............................................................................................................................................ = 0

[12900] bind(12, 0x9fffffffffffe390, 94) ............................................................................................................................................ = 0

sin_family: AF_UNIX

sun_path: /tmp/SocketStream.9008


Thanks

J.
Laurent Menase
Honored Contributor

Re: Socket permission issue

no the unlink() is there to remove any remaining socket fil before binding and recreate the socket file - else bind would fail

in fact you need to look for syscalls call on fd=12
Laurent Menase
Honored Contributor

Re: Socket permission issue

Finally how did it end up ? Did you find the solution?