Merge pull request #19 from normanmaurer/close_forcibly

Fix bug that would case an IllegalStateException when closeForcibly()…
This commit is contained in:
Josef Grieb 2020-09-02 09:27:01 +02:00 committed by GitHub
commit 77a133344f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 19 deletions

View File

@ -214,17 +214,20 @@ abstract class AbstractIOUringChannel extends AbstractChannel implements UnixCha
freeRemoteAddressMemory();
active = false;
IOUringSubmissionQueue submissionQueue = submissionQueue();
if ((ioState & POLL_IN_SCHEDULED) != 0) {
submissionQueue.addPollRemove(socket.intValue(), IOUring.POLLMASK_IN);
ioState &= ~POLL_IN_SCHEDULED;
// 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);
ioState &= ~POLL_IN_SCHEDULED;
}
if ((ioState & POLL_OUT_SCHEDULED) != 0) {
submissionQueue.addPollRemove(socket.intValue(), IOUring.POLLMASK_OUT);
ioState &= ~POLL_OUT_SCHEDULED;
}
submissionQueue.addPollRemove(socket.intValue(), IOUring.POLLMASK_RDHUP);
submissionQueue.submit();
}
if ((ioState & POLL_OUT_SCHEDULED) != 0) {
submissionQueue.addPollRemove(socket.intValue(), IOUring.POLLMASK_OUT);
ioState &= ~POLL_OUT_SCHEDULED;
}
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();
}
}