Resolution: Won't Fix
Affects Version/s: None
Fix Version/s: None
As part of the work for
SERVER-1094, we discovered that there was a change between JDK7 and JDK8 that causes exceptions to be thrown by shell execution libraries such as commons-exec in certain edge-case situations.
Specifically, if you call an external command and feed it an InputStream for its STDIN, and the external program doesn't consume that input stream, then commons-exec will throw an IOException with the fairly useless error message "Stream closed".
A simple reproducer is to use our puppetserver shell-utils code to call a command like /bin/true and pass it anything for its STDIN.
This doesn't happen on JDK7, it doesn't happen if the external program does read STDIN (e.g., works fine with cat), and doesn't happen if you call a program like /bin/true without passing it any STDIN data. After talking it through, we decided that for
SERVER-1094 we were just going to document this as a known issue and try to make sure that our error messages are useful enough for a user to figure out what's going on, and then wait for a fix upstream in commons-exec (which is the library that we are currently using to implement our shellutils).
Another option is to switch from commons-exec to zt-exec. That library has the same bug at the time of this writing, but the maintainers may be more proactive about fixing it than the commons-exec maintainers will be.
We've filed bug reports against both projects. At some point in the future we should check in on those and decide how we want to move forward.
Relevant bug reports are: