Skip to content

Fix: Up but dead service after OOMKill due to occupied port - #310

Merged
franklinkim merged 5 commits into
foomo:mainfrom
mrizk:fix/up-but-dead-service
Oct 1, 2026
Merged

franklinkim merged 5 commits into
foomo:mainfrom
mrizk:fix/up-but-dead-service

Conversation

@mrizk

@mrizk mrizk commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

Description

This PR fixes a bug where a server can come up and report that it's "healthy" despite failing to bind one or more of it's ports.

Type of Change

  • 🐛 Bug fix
  • ✨ New feature
  • 💥 Breaking change
  • 📝 Documentation
  • ♻️ Refactoring
  • 🏃‍➡️ Performance
  • ✅ Tests
  • 🔐 Security
  • 🔧 Build/CI

Related Issues

None

Changes

  • Update HTTP.Start() to first bind it's port, then set s.running to true and finally serve on said port, instead of blindly marking the service as running and then calling ListenAndServe()
  • In Server.startService(), gracefully shutdown the server if a service fails to start. The graceful shutdown goroutine waits on <-inst.gracefulCtx.Done() which is a context derived from inst.ctx, the errorgroup's gCtx is ignored, so an error thrown by one of the goroutines in the errorgroup does not trigger a graceful shutdown, instead Server.Run() just hangs.

Checklist

  • My code adheres to the coding and style guidelines of the project.
  • I have performed a self-review of my own code.
  • I have commented on my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.

Notes

None

@franklinkim

Copy link
Copy Markdown
Member

thx

@franklinkim
franklinkim merged commit a3ffeb2 into foomo:main Oct 1, 2026
1 check passed
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.

2 participants