With the code below, the expected result and what I see on Windows 10 is:
position: 10, count: 20
result: 20

On Debian 10 I see:
position: 10, count: 20
result: 16364

I believe transferFrom should never return more than the count passed to it, so this seems like a bug? I'm happy to give more information if needed.

Note the Undertow buffer size is 16364. Also, on Debian it really did write 16364 bytes to the output channel.

Cheers,
-Nate

int position = 10;
int count = 20;
StreamSinkChannel output = exchange.getResponseChannel();
FileChannel input = new RandomAccessFile(file, "r").getChannel();
while (count > 0) {
    long result;
    while (true) {
        System.out.println("position: " + position + ", count: " + count);
        result = output.transferFrom(input, position, count);
        System.out.println("result: " + result); // expected: <= 20
        if (result!= 0L) break;
        try {
            output.awaitWritable();
        } catch (InterruptedIOException ignored) {
        }
    }
    count -= result;
    position += result;
}