minidlna commit f9a78d598e48132a8c6cf9ce31b51163b6bd2f67 introduced a socket leak. When connect() is called on a socket set to non-blocking mode, the returned error code is EINPROGRESS. In that case, the code never initialises the ev structure and the socket reference is lost. Given enough time (on my network about a day and a half) this will eventually lead to a non-responsive server because the process runs out of fds. Netstat will show an excessive number of sockets stuck in CLOSE_WAIT state forever and ls /proc/<pid>/fd will confirm a lot of open sockets. I am attaching a patch that fixes the problem and has been submitted upstream. In the meantime, patching the ebuild should fix this serious bug that makes minidlna unusable. Reproducible: Always Steps to Reproduce: 1. Run minidlna 1.3.0 on a busy network with many DLNA servers and clients 2. Wait a day or two 3. Notice minidlna server becoming unresponsive, due to fd exhaustion and many sockets in CLOSE_WAIT state.
Created attachment 685224 [details, diff] Fixes leaked sockets by correctly initialising the ev struct Initialising the ev struct before a call to connect() ensures that the socket reference is not lost. Verifying with netstat, one can see the sockets in TIME_WAIT state for a brief period of time and /proc/<pid>/fd shows a reasonable number of sockets being open.
https://sourceforge.net/p/minidlna/git/merge-requests/38/
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2fe2484bb7f9de72413eb25deb02e4212d81c8d0 commit 2fe2484bb7f9de72413eb25deb02e4212d81c8d0 Author: Michał Górny <mgorny@gentoo.org> AuthorDate: 2021-01-31 09:14:14 +0000 Commit: Michał Górny <mgorny@gentoo.org> CommitDate: 2021-01-31 09:16:28 +0000 net-misc/minidlna: Fix socket leak Closes: https://bugs.gentoo.org/768030 Signed-off-by: Michał Górny <mgorny@gentoo.org> .../minidlna/files/minidlna-1.3.0-fd-leak.patch | 28 ++++++++++++++++++++++ ...idlna-1.3.0.ebuild => minidlna-1.3.0-r1.ebuild} | 5 ++-- 2 files changed, 31 insertions(+), 2 deletions(-)