nathanmarz/storm — pull request #424 by lyogavin (2012-12-17 22:27:17+00:00)
Title: Drain error stream periodically to avoid dead lock between ShellBolt and shell process

In this fix, I periodically drain the error stream so that if the buffer of error stream of shell process becomes full, it won't be blocked there thus result it dead lock between ShellBolt and the shell process.

I put the error stream reading logic in the writing thread as there's no non-blocking api to read error stream, if we read error stream in reading thread, we need to do some looping and sleeping, which impact the performance of normal reading. And it's not worthy to create another thread to do this. I think normally we can assume there won't be too much data output to error stream, so just periodically drain the error stream in writing thread seems enough.