Skip to content

add starlark debug server address flag#29377

Draft
1seal wants to merge 2 commits intobazelbuild:masterfrom
1seal:starlark-debug-loopback-default
Draft

add starlark debug server address flag#29377
1seal wants to merge 2 commits intobazelbuild:masterfrom
1seal:starlark-debug-loopback-default

Conversation

@1seal
Copy link
Copy Markdown

@1seal 1seal commented Apr 22, 2026

Summary

  • add --experimental_skylark_debug_server_address while preserving the existing default bind behavior
  • bind the Starlark debug server to an explicit address only when the new flag is set
  • cover both the default wildcard bind and an explicit loopback bind with focused unit tests

Why

This introduces the configuration knob first without breaking existing cross-machine debugger workflows. Users and internal tools can opt into a specific address now, and callers that need remote debugger access can explicitly set a non-loopback address before any future default change.

User impact

there is no behavior change by default.
users who want local-only debugger access can pass --experimental_skylark_debug_server_address=localhost or another loopback address.
users who intentionally attach from another host can continue relying on the current default for now, or set the required listen address explicitly.

Validation

  • git diff --check
  • /tmp/bazelisk test --test_output=errors //src/test/java/com/google/devtools/build/lib/starlarkdebug/server:StarlarkDebugServerTest //src/test/java/com/google/devtools/build/lib/starlarkdebug/server:StarlarkDebugIntegrationTest

@iancha1992 iancha1992 added team-Rules-Java Issues for Java rules team-Starlark-Interpreter Issues involving the Starlark interpreter used by Bazel labels Apr 22, 2026
Copy link
Copy Markdown
Member

@hvadehra hvadehra left a comment

Choose a reason for hiding this comment

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

While this is a reasonable change, it is a breaking one. That should be fine for Bazel, since this will go live only with Bazel 10. But will almost certainly end up being an issue internally where that will happen in O(days), and I strongly suspect tools / services have come to rely on this working across machines.

What I would suggest is we first introduce the flag with the default being the old/existing behavior. We can then update things internally to prepare for changing the default in a followup change (hopefully in just a week or two).

@VisibleForTesting
static ServerSocket createServerSocket(int port, @Nullable String listenAddress)
throws IOException {
InetAddress address =
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The docs for InetAddress.getName say the method already behaves exactly this way for null or empty inputs, so this is unnecessary.

@hvadehra hvadehra removed the team-Rules-Java Issues for Java rules label Apr 23, 2026
@1seal 1seal changed the title bind starlark debug server to loopback by default add starlark debug server address flag Apr 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

team-Starlark-Interpreter Issues involving the Starlark interpreter used by Bazel

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants