Overview
| Artifact ID: | 61481bcaf843bcd7f1429c60dad7d1f34ae6aafce26ac32ab6b87cc49f06f25f |
|---|---|
| Ticket: | c6897e6e6a8a65a995ec35c9c297b926bf1b6783
select notifier crashes/misbehaves on fd >= FD_SETSIZE |
| User & Date: | sebres on 2019-11-06 15:27:13 |
Changes
- icomment:
Sure, it's correct and I can follow your explanation (just the crash was even not reproducible to me)... Anyway, the branch is extended now and [001f178818] contains a first shot of proper fix for this - now it retards accepting in case of out of FD but continue to accept if some descriptors arrive again (gets closed later). As wewll as test cases covering both situations: - 2.14 - no free FD available<br/> - 2.15 - FD limit violates (exceeds) FD_SETSIZE Both tests cover continuation of accept in server-listener, if free descriptors become avaialable later. I see pretty well a busy wait for unpatched 8.6 (it hangs there) and 4 tests passed with my branch: <code><pre> $ ./tcltest ../tests/all.tcl -file socket.test -match '*-2.1[45]' ... all.tcl: Total 169 Passed 4 Skipped 165 Failed 0 </pre></code> Now why it is a first shot: although it properly fixes the issue (error on limit & continue to accept later), but in case of NOFILE-limit exceeding FD_SETSIZE it simply rejects the connection (what is not optimal).<br/> Better would be to extend notifier or async event handling to use epoll/poll (for all fd's <code>fd >= FD_SETSIZE</code>) or to rewrite waiting select to a bit hackish solution from [https://stackoverflow.com/a/7977082/7161854|SO/a/7977082/7161854] (e. g. <code>FD_SET(fd%FD_SETSIZE, &fds_array[fd/FD_SETSIZE])</code>) and then if it works remove all 3 extra prevention codes like [/artifact/cb2b27ad5d7eff89?ln=1216-1222|cb2b27ad5d7eff89, line 1216-1222] that I used at the moment against violation of the set-size limit. - login: "sebres"
- mimetype: "text/x-fossil-wiki"