ceylon-sdk
ceylon-sdk copied to clipboard
ceylon.net tests hang forever if server can't be started
I already had something running on port 8080 so the following happened when running the SDK tests:
.
.
.
[ceylon-test] running: test.ceylon.net::testPathMatcher
[ceylon-test] running: test.ceylon.net::testServer
[ceylon-test] Starting on 127.0.0.1:8080
[ceylon-test] Exception in thread "Thread-123" java.net.BindException: Address already in use
[ceylon-test] at sun.nio.ch.Net.bind0(Native Method)
[ceylon-test] at sun.nio.ch.Net.bind(Net.java:433)
[ceylon-test] at sun.nio.ch.Net.bind(Net.java:425)
[ceylon-test] at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
[ceylon-test] at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
[ceylon-test] at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:67)
[ceylon-test] at org.xnio.nio.NioXnioWorker.createTcpConnectionServer(NioXnioWorker.java:182)
[ceylon-test] at org.xnio.XnioWorker.createStreamConnectionServer(XnioWorker.java:243)
[ceylon-test] at ceylon.net.http.server.internal.DefaultServer.start$canonical$(DefaultServer.ceylon:175)
[ceylon-test] at ceylon.net.http.server.internal.DefaultServer.start(DefaultServer.ceylon:139)
[ceylon-test] at ceylon.net.http.server.internal.DefaultServer$1httpd_.run(DefaultServer.ceylon:206)
[ceylon-test] at java.lang.Thread.run(Thread.java:745)
And the process never stops, the tests never finish.
@matejonnet is this something you can take a look at? Perhaps Status
needs to be extended with an error
? Or always signal stopped
at least. Or perhaps skip waitTestToComplete()
if the server is in an invalid state somehow. You probably know best :)
Moving to 1.2.3
@matejonnet any ideas you could give us? This issue continues to exist and is a bit nasty.
This should solve the issue https://github.com/ceylon/ceylon-sdk/pull/619
It does, thanks!
So it seems this was only partly fixed, because on the CI server we still have the same problem:
.
.
.
[ceylon-test] running: test.ceylon.http.client::RequestLocalServerTest
[ceylon-test] running: test.ceylon.http.client::RequestLocalServerTest.defaultGet
[ceylon-test] Starting on 127.0.0.1:59746
[ceylon-test] Failed to start server.
[ceylon-test] Exception in thread "Thread-143" ceylon.http.server.ServerException "Failed to start server."
[ceylon-test] at ceylon.http.server.internal.DefaultServer.start$canonical$(DefaultServer.ceylon:190)
[ceylon-test] at ceylon.http.server.internal.DefaultServer.start(DefaultServer.ceylon:126)
[ceylon-test] at ceylon.http.server.internal.DefaultServer$1anonymous_0_.run(DefaultServer.ceylon:215)
[ceylon-test] Caused by: java.net.SocketException: Permission denied
[ceylon-test] at sun.nio.ch.Net.bind0(Native Method)
[ceylon-test] at sun.nio.ch.Net.bind(Net.java:463)
[ceylon-test] at sun.nio.ch.Net.bind(Net.java:455)
[ceylon-test] at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
[ceylon-test] at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
[ceylon-test] at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:67)
[ceylon-test] at org.xnio.nio.NioXnioWorker.createTcpConnectionServer(NioXnioWorker.java:182)
[ceylon-test] at org.xnio.XnioWorker.createStreamConnectionServer(XnioWorker.java:243)
[ceylon-test] at ceylon.http.server.internal.DefaultServer.start$canonical$(DefaultServer.ceylon:181)
[ceylon-test] ... 2 more
Build was aborted
Aborted by Jenkins Admin
Finished: ABORTED
And after this error the test again hangs forever. So I'm reopening this.
(Btw, the part about "Aborted by Jenkins Admin" was me, like 2 hours after the tests had been started. So it obviously wasn't going to recover by itself)
As an aside, I think this code related to the problem that @matejonnet improved the last time:
DefaultServer.ceylon:Line 187
} catch (IOException e) {
print("Failed to start server.");
notifyListeners(stopped);
throw ServerException("Failed to start server.", e);
}
should perhaps be changed to catching any Exception
, not just IOException
s. Because if there's some other, runtime, problem then we'd want to listeners to get notified as well, right?
Sounds right to catch all.