How to check dropped packets per process/socket when message drops are seen when socket buffer is full for unix domain sockets. netstat and ss tools are giving all statistics based on connection type. But is there any way to check dropped packets per process/socket when buffer is full?
As Unix Domain sockets are in their nature 'are reliable', and 'should' not drop data. Local sockets of type 'unix' are 'in memory data structures', they operate slightly different to network sockets (TCP/UDP etc). The main confusion is that the socket abstraction is trying to cover a lot different ways data gets in and out of a process (memory,file,disk,network).
As the data is traveling over the memory bus of the computer in this case, not a packet network (the internet), then the concept of dropped packets in this context doesn't make sense.
However, transmissions on a network is a different kettle of fish. It's quite possible for the remote network sender doesn't know when to stop, and the data doesn't have anywhere to go. Maybe the network cards buffers are full, or data has simply be discarded somewhere on it's trip over the network.
Unix sockets are 'reliable', but this abstraction is covering a lot of underlying transmission and buffering types. (packet networks (ip/x25/etc), protocols (udp/tcp/etc) or transfers directly via memory (on the same physical computer).
It's really up-to the application to keep track of these situations, especially when using unix domain sockets that are type 'unix'. Your application in question might be able to log these events or display statistics.
ss -a --unix -p Netid State Recv-Q Send-Q Local Address:Port Peer Address:Port u_dgr UNCONN 0 0 /run/systemd/cgroups-agent 9338 * 0 u_str LISTEN 0 128 /run/systemd/private 9339 * 0 u_str ESTAB 300 768 /var/run/dbus/system_bus_socket 13910 * 13895
As you can see, you can see how much data is in the send and receive queue for a domain socket of type 'unix'
netstat -x Active UNIX domain sockets (w/o servers) Proto RefCnt Flags Type State I-Node Path unix 2 [ N ] DGRAM 9481 /run/systemd/cgroups-agent unix 2 [ W ] DGRAM 38742 /run/user/0/systemd/notify
Flags: This is usually set to ACC , which represents SO_ACCEPTON, meaning the socket is waiting for a connection request. SO_WAITDATA, shown as W, means there is data waiting to be read. SO_NOSPACE as N, means there is no space to write data to the socket (i.e., the send buffer is full).