Skip to content

http: clean up listeners if some of the listeners fail to bind#7176

Merged
mholt merged 3 commits intomasterfrom
http-clean-listeners
Aug 21, 2025
Merged

http: clean up listeners if some of the listeners fail to bind#7176
mholt merged 3 commits intomasterfrom
http-clean-listeners

Conversation

@WeidiDeng
Copy link
Copy Markdown
Member

Fix 7175.

@WeidiDeng WeidiDeng requested a review from mholt August 13, 2025 06:33
Copy link
Copy Markdown
Member

@mholt mholt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Weidi!

I wonder if it's a design flaw that both Cleanup() and Stop() are necessary here...?

@mholt mholt merged commit f11c780 into master Aug 21, 2025
26 checks passed
@mholt mholt deleted the http-clean-listeners branch August 21, 2025 18:14
@WeidiDeng
Copy link
Copy Markdown
Member Author

They basically do the same for http app, but in different stages of a module life cycle. Stop is called when an app started successfully, Cleanup is called whether the app started successfully or not.

@francislavoie francislavoie added this to the v2.10.1 milestone Aug 22, 2025
mohammed90 pushed a commit to cedricziel/caddy that referenced this pull request Aug 29, 2025
…server#7176)

* http: clean up listeners if some of the listeners fail to bind

* check for nil server due to failure to start

---------

Co-authored-by: Matt Holt <mholt@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

http: listeners won't be closed if caddy fails to bind some of the addresses

3 participants