Skip to content

TomcatWebServer stop doesn't close sockets for additional connectors #38564

@soer84

Description

@soer84

Greetings!

As stated in this seemingly unrelated ticket #38554 we are currently facing an issue when running multiple Spring boot tests one after another.

i took the liberty and created a reproducer for this case. The tests in the attached zip file work with spring boot 3.1.5 but fail on 3.2.0.

In my example I add a new http connector with a fixed port. When running each test on its own they work. But if they're executed in a row i.e. by a mvn verify the second tests fails on initialization stating that the configured connector failed to start.

Maven doesn't print the reason too clearly unfortunately but a little closer investigation inside a IDE reveals the java.net.BindException: Address already in use: bind exception.

SpringTestReproducer.zip

In this example also the "@DirtiesContext" doesn't help. It seems as if the Spring / ApplicationContext is cleaned up and the new server instance is going to boot but the old instance of the server hasn't shut down yet or isn't shutting down at all.

Thanks in advance!

Metadata

Metadata

Assignees

Labels

type: regressionA regression from a previous release

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions