[CLOUDBEES-2018] fixing the root cause.
At some point after this code was originally written, I/O in remoting became asynchronous. So we need to sync with that before we swap out the new log output stream, or else you cut off stuff at the wrong moment. Normally the command transfer in remoting is slow enough that you get more or less synchronized output anyway, which is why this poblem remained unnoticed. But if the uncliamed buffer gets large, write operation will take a long time, which makes this issue more likely to show up. This fix address this problem by doing a proper sync. The recycling of ByteArrayOutputStream is also disabled because it makes synchronization tricky.
Loading
Please register or sign in to comment