Skip to content
Permalink
Browse files
Merge pull request #123 from jenkinsci/disable-nio
[FIXED JENKINS-39290] A debug flag to disable NIO
  • Loading branch information
kohsuke committed Oct 27, 2016
2 parents 9dc9317 + 678d9e9 commit 6575e82951b7f7c991db49e74261c52e40d1771b
Showing with 15 additions and 3 deletions.
  1. +8 −0 docs/configuration.md
  2. +1 −0 pom.xml
  3. +6 −3 src/main/java/org/jenkinsci/remoting/nio/NioChannelHub.java
@@ -92,6 +92,14 @@ These properties require independent configuration on both sides of the channel.
Property example: <code>org.jenkinsci.remoting.engine.JnlpProtocol3.disabled</code>
</td>
</tr>
<tr>
<td>org.jenkinsci.remoting.nio.NioChannelHub.disabled</td>
<td>false</td>
<td>2.62.3</td>
<td>?</td>
<td><a href="https://issues.jenkins-ci.org/browse/JENKINS-39290">JENKINS-39290</a></td>
<td>Boolean flag to disable NIO-based socket connection handling, and switch back to classic IO. Used to isolate the problem.</td>
</tr>-
<!--Template
<tr>
<td></td>
@@ -177,6 +177,7 @@ THE SOFTWARE.
<artifactId>access-modifier-annotation</artifactId>
<version>1.7</version>
<type>jar</type>
<optional>true</optional><!-- no need to have this at runtime -->
</dependency>
</dependencies>

@@ -11,6 +11,8 @@
import hudson.remoting.CommandTransport;
import hudson.remoting.SingleLaneExecutorService;
import org.jenkinsci.remoting.RoleChecker;
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.NoExternalUse;

import java.io.Closeable;
import java.io.EOFException;
@@ -472,7 +474,8 @@ public NioChannelBuilder newChannelBuilder(String name, ExecutorService es) {
protected CommandTransport makeTransport(InputStream is, OutputStream os, Mode mode, Capability cap) throws IOException {
if (r==null) r = factory.create(is);
if (w==null) w = factory.create(os);
if (r!=null && w!=null && mode==Mode.BINARY && cap.supportsChunking()) {
boolean disableNio = Boolean.getBoolean(NioChannelHub.class.getName()+".disabled");
if (r!=null && w!=null && mode==Mode.BINARY && cap.supportsChunking() && !disableNio) {
try {
// run() might be called asynchronously from another thread, so wait until that gets going
// if you see the execution hanging here forever, that means you forgot to call run()
@@ -492,9 +495,9 @@ protected CommandTransport makeTransport(InputStream is, OutputStream os, Mode m
else t = new DualNioTransport(getName(),r,w,cap);
t.scheduleReregister();
return t;
}
else
} else {
return super.makeTransport(is, os, mode, cap);
}
}
};
}

0 comments on commit 6575e82

Please sign in to comment.