On Tue, Nov 03, 2015 at 12:15:01AM +0300, Alexander V. Chernikov wrote:
Hi, * Currently, if the number of your established BGP sessions is larger than FD_SETSIZE limit, then you will get 100% cpu usage on select() (returning EINVAL for nfds) after trying to include the first fd>=FD_SETSIZE. Probably, the better way of handling this would be by explicitly rejecting active/passive sockets setup with proper error message so user could rebuild bird with appropriate limit without spending time on diagnosing 100% cpu usage issue.
Hi Thanks for the patch, that makes perfect sense. Will be merged ASAP. BTW, is it possible to change the limit by just redefining it and rebuilding BIRD? Aren't there any problems on the kernel side? Just some minor comment:
diff --git a/sysdep/unix/io.c b/sysdep/unix/io.c if (sk_setup(t) < 0) { /* FIXME: Call err_hook instead ? */ @@ -1404,6 +1415,12 @@ sk_open(sock *s) if (fd < 0) ERR("socket");
+ if (fd >= FD_SETSIZE) + { + log(L_ERR "Socket setup failed due to FD_SETSIZE limit (%d)", FD_SETSIZE); + ERR2("FD_SETSIZE limit reached"); + }
It is unnecessary to do log() here, ERR2() stores the error message in the socket and later it will be logged by the caller using sk_log_error(). -- Elen sila lumenn' omentielvo Ondrej 'Santiago' Zajicek (email: santiago@crfreenet.org) OpenPGP encrypted e-mails preferred (KeyID 0x11DEADC3, wwwkeys.pgp.net) "To err is human -- to blame it on a computer is even more so."
On 3 Nov 2015, at 00:19, Alexander V. Chernikov <melifaro@yandex-team.ru> wrote:
Not sure if bird needs os-dependent stuff like eventports/epoll/kqueue variant and own libev[ent], but having poll() as compile-time option might also be an option. (Not insisting on anything, select() is fine for our workload, just discussing).
I'm not sure you need to go as far as libevent. poll / ppoll are widely supported and avoid a linear scan of an array of 1024+ items. It's also relatively easy to put in a wrapper to make select() work like *poll() on systems that don't support it. -- Alex Bligh
participants (3)
-
Alex Bligh -
Alexander V. Chernikov -
Ondrej Zajicek