minidlna: file descriptor 3794 too big for select
se at freebsd.org
Tue Jun 24 08:26:45 UTC 2014
Am 23.06.2014 15:21, schrieb Bob Willcox:
> I just installed minidlna 1.1.3 on my system from ports and ran into the
> problem described in Stefan Essers' bug report 185155.
> Checking the source and the patch file extra-patch-kqueue I see that Stefan's
> suggested workaround has been included. However, the file upnpevents.c didn't
> 'know' about the increased FD_SETSIZE value so it failed with the following
> fatal error:
Yes, the diagnostic was just meant to report the issue, since the
message printed in the error case was not specific and misleading,
without this check.
Then I proposed to a patch that increased FD_SETSIZE, to not abort
with a clear indication of what went wrong, but instead to allow
the program to work with large media libraries.
But this was an intermediate step, too ... ;-)
> upnpevents.c:423: fatal: upnpevents_selectfds: file descriptor 3794 too big for select, limit is 1024
> So...I added a #define for FD_SETSIZE to the top of that file and things seem
> to be working ok now. Here's my simple patch:
> --- upnpevents.c.orig 2014-06-05 17:14:30.000000000 -0500
> +++ upnpevents.c 2014-06-23 07:47:53.000000000 -0500
> @@ -47,6 +47,7 @@
> #include "config.h"
> +#define FD_SETSIZE 8192
> #include <stdio.h>
> #include <string.h>
> #include <errno.h>
The use of select() is a bad choice when combined with kqueue(), since
data connections tend to be at the upper end of the FD range, while all
the thousands of file descriptors between the lowest few and topmost
few are for exclusive use by kqueue(), and thus never used in FD_SET.
To fix this problem without the need to adapt FD_SETSIZE to the number
of directories containing media files (and thus watched by kqueue()),
I developed a patch that converts minidlna to use poll() instead of
select(). This is more efficient (and IMHO also clearer), but I did not
make any attempt to get that patch accepted upstream.
I've been using the patched minidlna for more than 6 months without
any issues, and have moved the patch forward over two minor releases,
meanwhile. Since I wanted a minimal diff, indentation of the patched
files is not right (i.e. the patch has been created with "diff -bw").
I do not want to spam the mail-list with a large patch, that is only
of interest to a minority of readers, but I'll send it in private mail
to anybody showing interest.
More information about the freebsd-ports