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

  • 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/<pid-of-speaker-test>/fd/7 points to the receiving socket. – Thorsten Staerk Apr 4 '15 at 15:28
  • 1
    See Who's got the other end of this unix socketpair? for the first part of the second question. – Gilles 'SO- stop being evil' Apr 5 '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 6 '15 at 9:42

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>
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.