1

On my computer audio works sometimes and sometimes not. I want to troubleshoot this. First I verified I am using pulseaudio. I did this by strace'ing the pulseaudio process:

[pid  2289] send(28, "\0\0\0\24\377\377\377\377\0\0\0\0\0\0\0\0\0\0\0\0L\0\0\0=L\377\377\377\377L\0"..., 40, MSG_NOSIGNAL) = 40

At the same time the application speaker-test receives data from process 2289, pulseaudio. Many lines like this:

[pid 29146] recvmsg(7, {msg_name(0)=NULL, msg_iov(1)=[{"\0\0\0\0\377\377\377\377\0\0\0\20\0\0\0\0@\0\0\0", 20}], msg_controllen=24, {cmsg_len=24, cmsg_level=SOL_SOCKET, cmsg_type=SCM_CREDENTIALS{pid=2289, uid=0, gid=0}}, msg_flags=0}, 0) = 20

Now I can see the sockets are neighbors:

# ll /proc/29146/fd/7
lrwx------ 1 root root 64 Apr  4 16:46 /proc/29146/fd/7 -> socket:[114414]
# ll /proc/2289/fd/28
lrwx------ 1 root root 64 Apr  4 15:13 /proc/2289/fd/28 -> socket:[114415]

Which leads me to two questions:

  • why is pulseaudio sending data and speaker-test is receiving data? I would expect it to be the other way round.
  • where can I find that socket 114414 and 114415 are connected? Can I sniff their traffic?

BTW I am blogging this adventure on http://www.linuxintro.org/wiki/Sound_troubleshooting#strace.27ing_sound_II

Thorsten Staerk
  • 3,687
  • 1
  • 22
  • 28
  • when calling strace speaker-test I find a line connect(7, {sa_family=AF_LOCAL, sun_path="/run/user/0/pulse/native"}, 110) = 0 and then /proc//fd/7 points to the receiving socket. – Thorsten Staerk Apr 04 '15 at 15:28
  • 1
    See [Who's got the other end of this unix socketpair?](http://unix.stackexchange.com/questions/16300/whos-got-the-other-end-of-this-unix-socketpair) for the first part of the second question. – Gilles 'SO- stop being evil' Apr 05 '15 at 22:30
  • Thanks Gilles. And the second part of the second question - I can find this out with strace -s 9999. – Thorsten Staerk Apr 06 '15 at 09:42

1 Answers1

0

I found the answer here: https://stackoverflow.com/questions/820782/how-do-i-find-out-what-programs-on-the-other-end-of-a-local-socket/4834881#4834881

The answer is

ss -p | grep <socket-number>
Thorsten Staerk
  • 3,687
  • 1
  • 22
  • 28