spring-projects / spring-projects/spring-boot
Embedded web servers behave inconsistently when server.port is set to -1
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 81.5k
- Forks
- 42.7k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 65
Description
The behaviour is as follows when starting with server.port=-1:
- Jetty: app starts and stays running, but is not listening for HTTP connections
- Netty: app fails to start as -1 is an illegal port number
- Tomcat: app starts and stays running, but is not listening for HTTP connections
- Undertow: app starts and then stops
Further to the above, the way that autoStart is implemented at the moment is a little odd. When a web server is created with autoStart set to false, calling start() on that server will then have no effect and there's no way to set autoStart back to true so that the web server can be started. In other words, it's not really disabling automatic start, but disabling start altogether.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by comparing the embedded server startup paths for Jetty, Netty, Tomcat, and Undertow when server.port=-1, then inspect how autoStart controls the server lifecycle. Done means the port behavior is consistent across servers and a server created with autoStart=false can still be started explicitly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring-boot
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100