Skip to content

vert.x can't bind as previous vert.x test failed to close the port #1936

@jackshirazi

Description

@jackshirazi

Test method

co.elastic.apm.agent.vertx.v3.VertxServerTest

Also seeing essentially the same issue with the v4 vert.x test

Test logs

Click to expand
-------------------------------------------------------------------------------
Test set: co.elastic.apm.agent.vertx.v3.VertxServerTest
-------------------------------------------------------------------------------
Tests run: 20, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 4.158 s <<< FAILURE! - in co.elastic.apm.agent.vertx.v3.VertxServerTest
testWrongMethod  Time elapsed: 0.029 s  <<< ERROR!
java.net.BindException: Address already in use: bind
	at java.base/sun.nio.ch.Net.bind0(Native Method)
	at java.base/sun.nio.ch.Net.bind(Net.java:455)
	at java.base/sun.nio.ch.Net.bind(Net.java:447)
	at java.base/sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:227)
	at io.netty.channel.socket.nio.NioServerSocketChannel.doBind(NioServerSocketChannel.java:134)
	at io.netty.channel.AbstractChannel$AbstractUnsafe.bind(AbstractChannel.java:562)
	at io.netty.channel.DefaultChannelPipeline$HeadContext.bind(DefaultChannelPipeline.java:1334)
	at io.netty.channel.AbstractChannelHandlerContext.invokeBind(AbstractChannelHandlerContext.java:506)
	at io.netty.channel.AbstractChannelHandlerContext.bind(AbstractChannelHandlerContext.java:491)
	at io.netty.channel.DefaultChannelPipeline.bind(DefaultChannelPipeline.java:973)
	at io.netty.channel.AbstractChannel.bind(AbstractChannel.java:260)
	at io.netty.bootstrap.AbstractBootstrap$2.run(AbstractBootstrap.java:356)
	at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164)
	at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasksFrom(SingleThreadEventExecutor.java:428)
	at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:377)
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:488)
	at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
	at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
	at java.base/java.lang.Thread.run(Thread.java:829)

Additional context

This happens on Windows (Windows 10 Pro 21H1) and needs to be run as a sequence of the vertx tests for the failure to be seen. I think what's happening is that an error is being thrown (possibly vertx.disableTCCL is not correctly working on Windows) stopping the port being closed by the previous vertx test, resulting in the subsequent test being unable to bind to the port as the OS is still timing out the port from the previous test before allowing the next bind.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions