<div>š</div><div>š</div><div>03.11.2015, 01:29, "Ondrej Zajicek" <santiago@crfreenet.org>:</div><blockquote type="cite"><p>On Tue, Nov 03, 2015 at 12:15:01AM +0300, Alexander V. Chernikov wrote:</p><blockquote>ššššHi,<br />šššš*<br />ššššCurrently, if the number of your established BGP sessions is larger than<br />ššššFD_SETSIZE limit, then you will get 100% cpu usage on select() (returning<br />ššššEINVAL for nfds) after trying to include the first fd>=FD_SETSIZE.<br />ššššProbably, the better way of handling this would be by explicitly rejecting<br />ššššactive/passive sockets setup with proper error message so user could<br />ššššrebuild bird with appropriate limit without spending time on diagnosing<br />šššš100% cpu usage issue.</blockquote><p><br />Hi<br /><br />Thanks for the patch, that makes perfect sense. Will be merged ASAP.</p></blockquote><div>Great, thank you :)</div><blockquote type="cite"><p><br />BTW, is it possible to change the limit by just redefining it and<br />rebuilding BIRD? Aren't there any problems on the kernel side?</p></blockquote><div>Well, it depends. For FreeBSD setting FD_SETSIZE manually before sys header inclusion "just works" (and this is documented in select(2)).</div><div>The same would probably also work for Linux (not 100% sure about FORTIFY_SOURCE version).</div><div>It looks like people simply tend to switch to other primitives instead of fighting with FD_SETSIZE ( <a href="https://sourceware.org/bugzilla/show_bug.cgi?id=10352">https://sourceware.org/bugzilla/show_bug.cgi?id=10352</a>šis a good example).</div><div>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.</div><div>(Not insisting on anything, select() is fine for our workload, just discussing).</div><div>š</div><blockquote type="cite"><p><br />Just some minor comment:<br />š</p><blockquote>šdiff --git a/sysdep/unix/io.c b/sysdep/unix/io.c<br />ššššif (sk_setup(t) < 0)<br />šššš{<br />šššššš/* FIXME: Call err_hook instead ? */<br />š@@ -1404,6 +1415,12 @@ sk_open(sock *s)<br />ššššif (fd < 0)<br />ššššššERR("socket");<br /><br />š+ if (fd >= FD_SETSIZE)<br />š+ {<br />š+ log(L_ERR "Socket setup failed due to FD_SETSIZE limit (%d)", FD_SETSIZE);<br />š+ ERR2("FD_SETSIZE limit reached");<br />š+ }</blockquote><p><br />It is unnecessary to do log() here, ERR2() stores the error message in the<br />socket and later it will be logged by the caller using sk_log_error().</p></blockquote><div>Yes, the only reason I wrote log() was to print bundled FD_SETSIZE value.</div><div>Probably for the first time it will always be 1024, so that's fine :)</div><blockquote type="cite"><p>š</p><span>--<br />Elen sila lumenn' omentielvo</span><p><br />Ondrej 'Santiago' Zajicek (email: <a href="mailto:santiago@crfreenet.org">santiago@crfreenet.org</a>)<br />OpenPGP encrypted e-mails preferred (KeyID 0x11DEADC3, <a href="http://wwwkeys.pgp.net">wwwkeys.pgp.net</a>)<br />"To err is human -- to blame it on a computer is even more so."</p></blockquote>