Skip to content

Commit 088ebed

Browse files
committed
Skip OIO transport from FileRegion drain-loop overshoot test
OioByteStreamChannel#doWriteFileRegion drives its drain loop with a locally-tracked bytes-written counter and passes it as the transferTo position, never consulting region.transferred() for termination. The OvershootDetectingFileRegion fixture advances transferred() to count() after writing only one byte -- exactly to exercise the overshoot path on transports that do consult transferred() -- which violates OIO's position invariant and surfaces as a spurious IOException on the OIO permutation in CI. Skip the OIO client via assumeFalse(cc instanceof OioSocketChannel), mirroring the precedent in SocketShutdownOutputBySelfTest. The check runs alongside the existing supportsCustomFileRegion gate so the NIO/epoll/kqueue/io_uring permutations still cover the regression.
1 parent e28834a commit 088ebed

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketFileRegionTest.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import io.netty.channel.DefaultFileRegion;
2727
import io.netty.channel.FileRegion;
2828
import io.netty.channel.SimpleChannelInboundHandler;
29+
import io.netty.channel.socket.oio.OioSocketChannel;
2930
import io.netty.util.AbstractReferenceCounted;
3031
import io.netty.util.internal.ObjectUtil;
3132
import io.netty.util.internal.PlatformDependent;
@@ -49,6 +50,7 @@
4950
import static org.junit.jupiter.api.Assertions.assertEquals;
5051
import static org.junit.jupiter.api.Assertions.assertInstanceOf;
5152
import static org.junit.jupiter.api.Assertions.assertNotEquals;
53+
import static org.junit.jupiter.api.Assumptions.assumeFalse;
5254
import static org.junit.jupiter.api.Assumptions.assumeTrue;
5355

5456
public class SocketFileRegionTest extends AbstractSocketTest {
@@ -215,6 +217,15 @@ protected void channelRead0(ChannelHandlerContext ctx, ByteBuf msg) {
215217
Channel sc = sb.bind().sync().channel();
216218
Channel cc = cb.connect(sc.localAddress()).sync().channel();
217219
try {
220+
// OioByteStreamChannel#doWriteFileRegion drains using a locally-tracked
221+
// bytes-written counter as the transferTo position (ignoring transferred()), so an
222+
// ill-behaved FileRegion that advances transferred() past actual bytes written --
223+
// the exact pattern this fixture uses to exercise the overshoot path -- cannot
224+
// satisfy OIO's loop without violating the position invariant. The overshoot
225+
// detection is meaningless on OIO for the same reason; skip the permutation.
226+
assumeFalse(cc instanceof OioSocketChannel,
227+
"OIO transport does not honour transferred() for drain-loop termination");
228+
218229
OvershootDetectingFileRegion region = new OvershootDetectingFileRegion(regionSize);
219230
// sync() blocks until the write future completes, by which point every
220231
// transferTo() call the transport is going to make has already been made --

0 commit comments

Comments
 (0)