Skip to content

Show which processes hold the Breeze UI ports when start-airflow fails - #72564

Open
Andrushika wants to merge 1 commit into
apache:mainfrom
Andrushika:breeze-port-conflict-show-pid
Open

Show which processes hold the Breeze UI ports when start-airflow fails#72564
Andrushika wants to merge 1 commit into
apache:mainfrom
Andrushika:breeze-port-conflict-show-pid

Conversation

@Andrushika

Copy link
Copy Markdown
Contributor

Why

Follow-up of #71241: breeze start-airflow --dev-mode fails early when port 5173 or 5174 is taken. But the message only says the port is in use. Users then need to run lsof themselves to see which processes hold the ports before they can stop them, which is a bit annoying. Most of the time it is just a stale Vite dev server left over from a previous breeze run.

What

Look up the listening process with psutil and print its PID and command line, plus a kill <pid> hint. If the listener cannot be found (for example no permission), the old message is kept. psutil is bumped to >=6.0.0 because Process.net_connections() was added there.

Before:

Cannot start UI development servers because the following local port(s) are already in use: 5173, 5174.
Stop the processes using these ports and try again.

Now:

Cannot start UI development servers because the following local port(s) are already in use: 5173, 5174.
Port 5173 is used by PID 5771: node /Users/andrewchang/Dev/github.com/airflow/airflow-core/src/airflow/ui/node_modules/.bin/../vite/bin/vite.js —port 5173 —strictPort
Port 5174 is used by PID 5793: node /Users/andrewchang/Dev/github.com/airflow/airflow-core/src/airflow/api_fastapi/auth/managers/simple/ui/node_modules/.bin/../vite/bin/vite.js —port 5174 —strictPort
Stop the processes using these ports (for example kill 5771 5793) and try again.

related: #71241


Was generative AI tooling used to co-author this PR?
  • Yes — Claude Code (Fable 5.1)

Generated-by: Claude Code (Fable 5.1) following the guidelines

@SameerMesiah97 SameerMesiah97 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could we also add testcoverage for the best-effort failure handling in _find_local_port_listeners, particularly when inspecting a process raises psutil.Error?

@Andrushika
Andrushika force-pushed the breeze-port-conflict-show-pid branch from f5614a3 to 420b499 Compare September 5, 2026 17:25
@Andrushika

Copy link
Copy Markdown
Contributor Author

Added a test: test_find_local_port_listeners_skips_processes_that_cannot_be_inspected, thanks for reviewing!

@Andrushika
Andrushika force-pushed the breeze-port-conflict-show-pid branch from 420b499 to 173cb4c Compare September 5, 2026 17:38
…fails

Since apache#71241 `breeze start-airflow --dev-mode` refuses to start when the
Vite ports are taken, but the message did not say by what. The usual
culprit is a stale dev server left behind by a previous breeze run, and
the user had to hunt for it with lsof before they could kill it. Printing
the PID and command line, plus a ready-to-paste kill hint, removes that
step. psutil is bumped to >=6.0.0 for Process.net_connections().
@Andrushika
Andrushika force-pushed the breeze-port-conflict-show-pid branch from 173cb4c to 4335517 Compare September 5, 2026 17:43
@Andrushika
Andrushika marked this pull request as draft September 5, 2026 19:06
@Andrushika
Andrushika marked this pull request as ready for review September 5, 2026 19:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants