SlaveComputer uses a ReopenableFileOutputStream for it's log
introduced by https://github.com/jenkinsci/jenkins/commit/0ddb0c5cca757a4a34e0c162bbca6504f5cec25f, intent was to track some termination issue and report status to user.
this results in a file-leak when channel.onClose logs termination but kill() already invoked close on the log stream. By nature, ReopenableFileOutputStream introduce a risk for a writer to reopen the stream without any control on who is responsible to close it.
in the meantime, https://github.com/jenkinsci/jenkins/commit/733f091125099a7ed823c0d0d7cb96ae8d39f364 introduced deletion of the slave's log directory on termination (which makes previous fix useless)
Depending on race condition, this can result in:
- listener to fail log it's termination status - but PrintStream#write do capture the IOException and PrintStream#checkError is never checked, so silently ignored
- slave log directory deletion to fail due to file lock issue (detected on Windows), resulting in a non-blocker error reported in Jenkins log.