[systemd-devel] systemd loses a netlink socket

Andrei Vagin avagin at gmail.com
Sat Feb 18 00:58:45 UTC 2017


Hello,

I found that systemd-networkd creates a netlink socket and then
doesn't read data from it. The reason is that a stream of messages
into this socket is too active, so they fill the socket buffer and
recvmsg() returns -ENOBUF.

We have to close this socket or set NETLINK_NO_ENOBUFS to avoid the error.

root at localhost:/# ps axf
...
  100 ?        Ss     0:00 /lib/systemd/systemd-networkd
...

root at localhost:/# cat /proc/net/netlink
sk       Eth Pid    Groups   Rmem     Wmem     Dump     Locks
Drops     Inode
0000000000000000 0   1      00000551 426412   0        0 2
881909   1111601
...

root at localhost:/# lsof -p 100 | grep 1111601
systemd-n 100 systemd-network    3u  netlink
0t0 1111601 ROUTE

root at localhost:/# strace -f -p 100 -s 256 -o log
...
100   recvmsg(3, {msg_name(12)={sa_family=AF_NETLINK, pid=0,
groups=00000040}, msg_iov(1)=[{"4\0\0\0\31\0\0\0\0\0\0\0\237\2\0\0\2
\0\0\376\4\0\1\0\0\0\0\10\0\17\0\376\0\0\0\10\0\1\0\300\250\0\377\10\0\4\0\1\0\0\0",
4552}], msg_controllen=24, [{cmsg_len=20, cmsg_level=SOL_NETLINK,
cmsg_type=3}], msg_flags=MSG_CTRUNC}, MSG_TRUNC) = 52
100   epoll_wait(5, [{EPOLLIN, {u32=4059701360,
u64=139848194859120}}], 8, 0) = 1
100   clock_gettime(CLOCK_MONOTONIC, {60, 571403118}) = 0
100   epoll_wait(5, [{EPOLLIN|EPOLLERR, {u32=4059701360,
u64=139848194859120}}], 8, 0) = 1
100   clock_gettime(CLOCK_MONOTONIC, {60, 571455802}) = 0
100   recvmsg(3, 0x7ffce6f903e0, MSG_PEEK|MSG_TRUNC) = -1 ENOBUFS (No
buffer space available)
100   epoll_ctl(5, EPOLL_CTL_DEL, 3, NULL) = 0

root at localhost:/# dpkg -l | grep systemdu
ii  systemd                       231-9ubuntu2
amd64        system and service manager

Thanks,
Andrei


More information about the systemd-devel mailing list