Fix bug that would case an IllegalStateException when closeForcibly() is called and the Channel is not registered yet.

This commit is contained in:
Norman Maurer 2020-09-02 09:22:53 +02:00
parent c7f6ba0a55
commit 5423eb9401
2 changed files with 13 additions and 19 deletions

View File

@ -214,6 +214,8 @@ abstract class AbstractIOUringChannel extends AbstractChannel implements UnixCha
freeRemoteAddressMemory();
active = false;
// doClose() may be called by closeForcibly() before the Channel is registered on the EventLoop.
if (isRegistered()) {
IOUringSubmissionQueue submissionQueue = submissionQueue();
if ((ioState & POLL_IN_SCHEDULED) != 0) {
submissionQueue.addPollRemove(socket.intValue(), IOUring.POLLMASK_IN);
@ -225,6 +227,7 @@ abstract class AbstractIOUringChannel extends AbstractChannel implements UnixCha
}
submissionQueue.addPollRemove(socket.intValue(), IOUring.POLLMASK_RDHUP);
submissionQueue.submit();
}
// Even if we allow half closed sockets we should give up on reading. Otherwise we may allow a read attempt on a
// socket which has not even been connected yet. This has been observed to block during unit tests.

View File

@ -19,8 +19,6 @@ import io.netty.bootstrap.Bootstrap;
import io.netty.bootstrap.ServerBootstrap;
import io.netty.testsuite.transport.TestsuitePermutation;
import io.netty.testsuite.transport.socket.SocketCloseForciblyTest;
import org.junit.Ignore;
import org.junit.Test;
import java.util.List;
@ -29,11 +27,4 @@ public class IOUringSocketCloseForciblyTest extends SocketCloseForciblyTest {
protected List<TestsuitePermutation.BootstrapComboFactory<ServerBootstrap, Bootstrap>> newFactories() {
return IOUringSocketTestPermutation.INSTANCE.socket();
}
@Ignore("FIX ME")
@Test
@Override
public void testCloseForcibly() throws Throwable {
super.testCloseForcibly();
}
}