Jenkins doesn't recognize slave being down and thus does not allow for it to reconnect
<p>We have a Jenkins instance running on Ubuntu that has several slaves in different systems. One of them is a Windows 7 host, having jenkins slave instance configured as a service.</p>

<p>We have a problem that when that machine is rebooted, master Jenkins doesn't realize it's gone. It looks to be just fine in the nodes view. Then, when a build is issued that is supposed to use that slave it gets stuck. If that is stopped, the next build fails immediately</p>

<pre><code>Caused by: java.util.concurrent.TimeoutException: Ping started at 1457016721684 hasn't completed by 1457016961684
    ... 2 more
[EnvInject] - [ERROR] - SEVERE ERROR occurs: channel is already closed
</code></pre>

<p>When the slave has started up and it tries to connect back to master, connection is refused, and in the logs there is an error saying connection with that name already exists:</p>

<pre><code>Server didn't accept the handshake: xxx is already connected to this master. Rejecting this connection.
</code></pre>

<p>There is issue <a href="https://issues.jenkins-ci.org/browse/JENKINS-5055" rel="nofollow">JENKINS-5055</a> which claims a fix was committed allowing the same JNLP slave to reconnect without getting rejected, apparently <a href="https://github.com/jenkinsci/jenkins/commit/68ed742227891a3f716e4e479388c36876bb935a" rel="nofollow">this commit</a>, and according to <a href="https://jenkins-ci.org/changelog-old.html" rel="nofollow">changelog</a>, it was introduced in version 1.396 (2011/02/02). We are however using version 1.639 and seeing this. <a href="http://comments.gmane.org/gmane.comp.java.jenkins.user/29769" rel="nofollow">Somebody else</a> seems to be seeing it as well. By looking at <a href="https://github.com/jenkinsci/jenkins" rel="nofollow">current codebase</a>, I see <a href="https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/jenkins/slaves/JnlpSlaveAgentProtocol.java#L104" rel="nofollow">where the error is coming from</a>, but don't see the fix done in Jenkins-5055.</p>

<p>Any ideas on resolving this?</p>

<p>Edit: also <a href="https://groups.google.com/forum/#!topic/jenkinsci-users/yeqIPPhYj0U" rel="nofollow">asked on jenkins user mailing list</a>, but no responses.</p>