zedshaw/mongrel2 — pull request #111 by typingArtist (2012-02-23 12:09:58+00:00)
Title: 3 fixes for fixing races, reducing error log utilization and allowing more than 65535 connections

Hi Zed,

as discussed – or mere: presented – on the list, here is the pull request for these changes. Sorry, all in one go because I’m still a github newbie … :)

Fix #1 addresses a – most probably – rare event that a RadixMap key is re-used but being still valid after a wraparound. https://github.com/typingArtist/mongrel2/commit/94449e9ad96246abd74636bdacdb41ccd255913f

Fix #2 allows more than 65535 connections to the server. The current code makes a wrong range check wrongly comparing the id range with the fd range. https://github.com/typingArtist/mongrel2/commit/28d6127a2109e495f8094aa8518e7fd849924e8c

Fix #3 is just reducing unnecessary error log output. https://github.com/typingArtist/mongrel2/commit/f3cba69afb687efb34801c8589d4260238feb42a

Fix #4 removes a race under high load where the OS re-uses fds that are still in use by one thread (task). The thread is not able to correctly close connections then. I managed to work with `ab` and concurrency values to 1000 and above, while before it lost connections already at concurrency values of 5. https://github.com/typingArtist/mongrel2/commit/9946d6c1133ebd4c0aa992f5e581ecdee1e3d90c