There’s an adage in software engineering: select() isn’t broken. It refers to the fact that the vast majority of the time, a troublesome bug is in your code, not the OS, compiler, or even more rarely, a CPU.  A post by Jeff Atwood cites a study that asserts the ratio of time a bug is caused by systems software, other software, and hardware to be around 2%, 1%, and 1% respectively. Thus, the old adage is nothing more than a rule of thumb on how to wisely spend your time when searching for the root cause, nothing more. Infrequently, however, select() is actually broken!

I was recently bitten by a bug while working with Java 7u5. The random UUID generator has a multi-threaded race condition. Check out the history on my stack overflow post. The first reader made a snide comment. 96% of the time he’d be correct. In this particular situation it turned out that there is a bug being fixed in 7u6. I was quite convinced for a few hours that the bug must be an interaction between Scala 2.10M6 and Java 7u5, but I finally was able to write a java program to reproduce it.