<div dir="ltr">With the code below, the expected result and what I see on Windows 10 is:<br>position: 10, count: 20<br>result: 20<br><br>On Debian 10 I see:<br>position: 10, count: 20<br>result: 16364<br><br>I believe <span class="gmail_default" style="font-size:small"></span>transferFrom should never return more than the count passed to it, so this seems like a bug? I&#39;m happy to give more information if needed.<br><br>Note the Undertow buffer size is 16364. Also, on Debian it really did write 16364 bytes to the output channel.<br><br>Cheers,<br>-Nate<br><br>int position = 10;<br>int count = 20;<br>StreamSinkChannel output = exchange.getResponseChannel();<br>FileChannel input = new RandomAccessFile(file, &quot;r&quot;).getChannel();<br>while (count &gt; 0) {<br>    long result;<br>    while (true) {<br>        System.out.println(&quot;position: &quot; + position + &quot;, count: &quot; + count);<br>        result = output.transferFrom(input, position, count);<br>        System.out.println(&quot;result: &quot; + result); // expected: &lt;= 20<br>        if (result!= 0L) break;<br>        try {<br>            output.awaitWritable();<br>        } catch (InterruptedIOException ignored) {<br>        }<br>    }<br>    count -= result;<br>    position += result;<br>}<br></div>