Skip to content

feat(framework): Support port 0 for OS-assigned random unused port#6795

Merged
danieljanes merged 5 commits intomainfrom
allow-random-port
Mar 23, 2026
Merged

feat(framework): Support port 0 for OS-assigned random unused port#6795
danieljanes merged 5 commits intomainfrom
allow-random-port

Conversation

@panh99
Copy link
Member

@panh99 panh99 commented Mar 19, 2026

Summary

  • expose bound_address from generic_create_grpc_server
  • use the bound address in server startup logs when ports are assigned dynamically
  • update integration tests to bind on port 0 and connect via the bound address

Copilot AI review requested due to automatic review settings March 19, 2026 18:05
@panh99 panh99 changed the title Use bound address for gRPC server logs feat(framework): Use bound address for gRPC server logs Mar 19, 2026
@panh99 panh99 changed the title feat(framework): Use bound address for gRPC server logs feat(framework): Support port 0 for OS-assigned random unused port Mar 19, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR improves gRPC server startup logging and test robustness by exposing and using the actual bound address (especially when binding to port 0 for dynamic port allocation) across SuperLink/SuperNode components.

Changes:

  • Expose the bound address from generic_create_grpc_server via server.bound_address and use it in startup logs.
  • Allow port 0 in address parsing and skip port-availability checks for port 0.
  • Update integration tests to bind on port 0 and (where applicable) connect using the bound address.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
framework/py/flwr/common/grpc.py Captures the actual bound port from gRPC and exposes it as server.bound_address.
framework/py/flwr/supercore/address.py Allows port 0 in parsing and treats it as “no need to check availability”.
framework/py/flwr/supercore/address_test.py Updates address parsing tests to treat port 0 as valid.
framework/py/flwr/server/app.py Logs Fleet API startup using the server’s bound address.
framework/py/flwr/superlink/servicer/control/control_grpc.py Logs Control API startup using the server’s bound address.
framework/py/flwr/server/superlink/serverappio/serverappio_grpc.py Logs ServerAppIo API startup using the server’s bound address.
framework/py/flwr/server/superlink/simulation/simulationio_grpc.py Logs SimulationIo API startup using the server’s bound address.
framework/py/flwr/supercore/grpc_health/health_server.py Logs health server startup using the server’s bound address.
framework/py/flwr/supernode/start_client_internal.py Logs ClientAppIo API startup using the server’s bound address.
framework/py/flwr/server/superlink/fleet/grpc_bidi/grpc_server_test.py Uses port 0 for binding in integration tests (removes “unused port” helper).
framework/py/flwr/compat/client/grpc_client/connection_test.py Uses port 0 for server binding and connects via the server’s bound address.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

@github-actions github-actions bot added the Maintainer Used to determine what PRs (mainly) come from Flower maintainers. label Mar 19, 2026
@danieljanes danieljanes enabled auto-merge (squash) March 23, 2026 12:05
@danieljanes danieljanes merged commit 4b881c7 into main Mar 23, 2026
70 checks passed
@danieljanes danieljanes deleted the allow-random-port branch March 23, 2026 12:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Maintainer Used to determine what PRs (mainly) come from Flower maintainers.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants