Comment From: wilkinsona
Unfortunately, Undertow 2.3.14 hangs regularly when it's being stopped in one of our integration tests:
"Test worker" #1 prio=5 os_prio=31 cpu=232391.70ms elapsed=2070.06s tid=0x00007f98c4008800 nid=0x2703 waiting on condition [0x00007000020d6000]
java.lang.Thread.State: WAITING (parking)
at jdk.internal.misc.Unsafe.park(java.base@17.0.11/Native Method)
at java.util.concurrent.locks.LockSupport.park(java.base@17.0.11/LockSupport.java:341)
at org.xnio.nio.WorkerThread$SelectNowTask.doWait(WorkerThread.java:915)
at org.xnio.nio.WorkerThread.cancelKey(WorkerThread.java:793)
at org.xnio.nio.NioHandle.cancelKey(NioHandle.java:91)
at org.xnio.nio.NioTcpServer.close(NioTcpServer.java:261)
at org.xnio.nio.QueuedNioTcpServer2.close(QueuedNioTcpServer2.java:126)
at org.xnio.IoUtils.safeClose(IoUtils.java:152)
at io.undertow.Undertow.stop(Undertow.java:262)
- locked <0x00000007e3452cf8> (a io.undertow.Undertow)
at org.springframework.boot.web.embedded.undertow.UndertowWebServer.destroySilently(UndertowWebServer.java:144)
at org.springframework.boot.web.embedded.undertow.UndertowWebServer.start(UndertowWebServer.java:135)
- locked <0x00000007e34529d0> (a java.lang.Object)
at org.springframework.boot.web.servlet.server.AbstractServletWebServerFactoryTests.lambda$portClashOfSecondaryConnectorResultsInPortInUseException$32(AbstractServletWebServerFactoryTests.java:1103)
at org.springframework.boot.web.servlet.server.AbstractServletWebServerFactoryTests$$Lambda$11480/0x00000001267dcb00.call(Unknown Source)
at org.assertj.core.api.ThrowableAssert.catchThrowable(ThrowableAssert.java:63)
at org.assertj.core.api.ThrowableTypeAssert.isThrownBy(ThrowableTypeAssert.java:59)
at org.springframework.boot.web.servlet.server.AbstractServletWebServerFactoryTests.lambda$portClashOfSecondaryConnectorResultsInPortInUseException$34(AbstractServletWebServerFactoryTests.java:1099)
at org.springframework.boot.web.servlet.server.AbstractServletWebServerFactoryTests$$Lambda$11479/0x00000001267dc8d8.run(Unknown Source)
at org.springframework.boot.web.servlet.server.AbstractServletWebServerFactoryTests.doWithBlockedPort(AbstractServletWebServerFactoryTests.java:1637)
at org.springframework.boot.web.servlet.server.AbstractServletWebServerFactoryTests.portClashOfSecondaryConnectorResultsInPortInUseException(AbstractServletWebServerFactoryTests.java:1098)
I think we need to revert this, for now at least.
Comment From: wilkinsona
The problem can be reproduced without Boot in a minimal unit test:
package com.example;
import static org.assertj.core.api.Assertions.assertThatRuntimeException;
import java.io.IOException;
import java.net.BindException;
import java.net.InetSocketAddress;
import java.net.ServerSocket;
import org.junit.jupiter.api.Test;
import io.undertow.Undertow;
class UndertowTests {
@Test
void startWithPortClashOnSecondHttpListenerThrowsRuntimeException() throws IOException {
try (ServerSocket socket = new ServerSocket()) {
socket.bind(new InetSocketAddress("0.0.0.0", 0));
int clashPort = socket.getLocalPort();
Undertow undertow = Undertow.builder()
.addHttpListener(0, "0.0.0.0")
.addHttpListener(clashPort, "0.0.0.0").build();
try {
assertThatRuntimeException().isThrownBy(undertow::start).withCauseInstanceOf(BindException.class);
}
finally {
undertow.stop();
}
}
}
}
I've opened https://issues.redhat.com/browse/UNDERTOW-2420. I think we should prohibit upgrades to 2.3.14.Final.
Comment From: wilkinsona
Closed by c05a40f180d3a6048ad2099b16039373624348eb.