Skip to content

bazel/rc: Rationalize flags - #47806

Merged
phlax merged 2 commits into
envoyproxy:mainfrom
phlax:bazelrc
Sep 29, 2026
Merged

phlax merged 2 commits into
envoyproxy:mainfrom
phlax:bazelrc

Conversation

@phlax

@phlax phlax commented Sep 28, 2026 •

Copy link
Copy Markdown
Member
  • adds stdlib autodetection
  • with bzlmod toolchain detection is now automatic so no need for --config=clang
  • removed setup_clang_toolchain from ci
  • remove config=clang-local as it no longer worked and now point to codeql example
  • clang+libstdc++ no longer works ootb as it requires additional toolchain setup (so is left as an exercise for downstreams that may need it)
  • rationalizes .bazelrc files to make more minimal and remove obsolete configs

@phlax phlax changed the title [WIP] bazel/rc: Rationalize flags bazel/rc: Rationalize flags Sep 29, 2026
@phlax
phlax marked this pull request as ready for review September 29, 2026 16:38
@phlax

phlax commented Sep 29, 2026

Copy link
Copy Markdown
Member Author

/retest

@jwendell jwendell left a comment

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.

Thanks for this cleanup, it simplifies things a lot. A few things I noticed, mostly about moving flags around (inline below).

Nit (file not in the diff): .devcontainer/README.md (lines 28-31) still tells users to pass --config=remote, which no longer exists in .bazelrc.

Comment thread .bazelrc
build --per_file_copt=contrib/kafka/.*\.cc@-Wno-old-style-cast

# protobuf
common --incompatible_enable_proto_toolchain_resolution=true

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.

Dropping prefer_prebuilt_protoc looks fine, since it defaults to True now. But --incompatible_enable_proto_toolchain_resolution still defaults to false on Bazel 8.8.0 (bazel help build). Without it, protobuf's toolchain_helpers.bzl falls back to the legacy --proto_compiler path. I think that means we go back to building protoc from source, which undoes #46570.

I'm not sure the --THIS_CC_TOOLCHAIN_IS_BROKEN guard below would catch this. It matches bazel-out/.*/bin/external/protobuf.*/protoc, but protoc's sources are under external/protobuf+/src/....

Also, bazel/tests/external/.bazelrc and bazel/tests/codeql/.bazelrc still set this flag. Was removing it from the root intentional? If not, could we keep it here, or in ci.bazelrc so every workspace gets it?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

so i originally removed all on bot advice - then tested and saw it was using the non-prebuilt so put back in external - will update

Comment thread ci/do_ci.sh Outdated
# TODO(phlax): Remove this once ci lands
if [[ -e repo.bazelrc ]]; then
cp -a repo.bazelrc user.bazelrc
fi

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.

This copy runs after build_setup.sh is sourced. build_setup.sh already calls bazel info --announce_rc to detect remote exec/cache, and uses that to set --test_tmpdir and the new BAZEL_QUERY_OPTIONS. With .bazelrc no longer try-importing repo.bazelrc, runs that still write repo.bazelrc would miss the remote config there.

Would it make sense to do the copy before sourcing build_setup.sh? Also, this overwrites any existing user.bazelrc. That's probably fine in CI, but I wanted to mention it.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

yeah - will move it higher - its a disaster waiting to happen so will need to be removed immediately after landing

Comment thread bazel/BUILD
)

bool_flag(
name = "libc++",

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.

@envoy//bazel:libc++ and @envoy//bazel:libstdc++ have been public flags since #39755. Downstreams that set --@envoy//bazel:libc++=true in their rc files will now fail with "no such target". force_libcpp got a back-compat alias. Could these get either a deprecated no-op bool_flag for one release, or a line in the build__remove-config-clang.rst changelog?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

ill update the changelog - i think it makes more sense to not keep non-functional flags around

agrawroh
agrawroh previously approved these changes Sep 29, 2026
Signed-off-by: Ryan Northey <[email protected]>
@phlax
phlax disabled auto-merge September 29, 2026 19:48
@phlax
phlax merged commit 2279a09 into envoyproxy:main Sep 29, 2026
31 checks passed
bpalermo added a commit to bpalermo/aether that referenced this pull request Oct 10, 2026
…the two carried patches it contains are dropped (#980) (#1643)

The pin is one fact in three places and moves as one: envoy and envoy_api
(proxy/MODULE.bazel) and the envoyproxy/bazel-registry commit
(proxy/.bazelrc, 5db29c09de17218d24f58c665be38208284754d8), written by
scripts/bump-envoy-pin.sh. rules_python follows what the envoy module
requests (2.2.0 -> 2.3.3). The lockfile is refreshed.

Dropped, because Envoy 189f198 contains them:
- envoy-47743-udp-hot-restart-forwarding-netns (envoyproxy/envoy#47743,
  a644fc670e): the carried hunks reverse-apply cleanly to the snapshot.
- envoy-aether1022-exec-in-netns-thread-self (envoyproxy/envoy#47776,
  7d6ca3273c): the snapshot opens /proc/thread-self/ns/net. The carried
  fallback for kernels older than 3.17 and its per-thread model test go with
  it.

Kept, in the same order:
- 47740 (still open upstream): unchanged content, hunk positions refreshed.
- aether1050: replaced by the diff of its upstream pull request,
  envoyproxy/envoy#47834 at 72408727eb, docs and changelog dropped. Same
  source as before plus three counters,
  server.hot_restart_udp_forwarding_{datagrams,retries,dropped}; the test
  hunks no longer carry the 47743 test changes.
- aether1054: rebased over envoyproxy/envoy#47991, which rewrote
  ConnectionManagerImpl::onDrain() to drain idle connections proactively in
  the last third of the drain time. That arms nothing when the drain time
  leaves no room after the drain timeout (the chart's 10s with the default
  5s), so the carried idle HTTP/3 drain stays, armed beside it from
  armIdleHttp3DrainTimer(). Upstream's ProactiveDrain* tests notify the drain
  before a codec exists and turn the carried timer off; the carried gradual
  case now asserts both timers.
- aether1054b, aether1054c, aether1074, aether1126: unchanged content.

proxy/.bazelrc: envoyproxy/envoy#47806 removed the --@envoy//bazel:libc++
flag and the force_libcpp define, so both leave the libc++ config; nothing
else upstream removed from its own .bazelrc is required to go, and the rest
is kept as built before.

Refs #980


Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr

Co-authored-by: Claude Opus 5.5 <[email protected]>
tomjzzhang added a commit to tomjzzhang/nighthawk that referenced this pull request Oct 18, 2026
When envoyproxy#1627 synced .bazelrc with upstream Envoy PR envoyproxy/envoy#47806, it removed try-import %workspace%/repo.bazelrc from the bottom of .bazelrc. However, .github/workflows/_ci.yml still writes the CI compiler and resource configurations to repo.bazelrc, so Bazel no longer loads those settings during CI runs.

This PR replaces repo.bazelrc with user.bazelrc in .github/workflows/_ci.yml (and adds the upstream Envoy fallback in ci/do_ci.sh to copy repo.bazelrc to user.bazelrc if present), as user.bazelrc remains imported at the bottom of .bazelrc and ignored by .gitignore.

Signed-off-by: tomjzzhang <[email protected]>
mattklein123 pushed a commit that referenced this pull request Oct 20, 2026
…7893)

Commit Message: http3: keep the persistent QUIC info alive while its
pools use it
Additional Description:

Removing an HTTP/3 upstream cluster while it has requests in flight can
crash Envoy with a use-after-free in the QUIC client connection
(SIGSEGV/SIGBUS in `quic::QuicConnection::OnCanWrite` → `CanWrite`,
reached from `EnvoyQuicClientConnection::onFileEvent`, or from an
alarm).

`Quic::PersistentQuicInfoImpl` holds the QUIC helpers shared by a
cluster's HTTP/3 connections: the connection helper with its
`EnvoyQuicClock`, the alarm factory, the QUIC config, the crypto stream
factory and the writer factory. Since #19862 it is owned by the
thread-local `ClusterEntry` (`quic_info_`, a `unique_ptr`),
`Http3ConnPoolImpl` and `ConnectivityGrid` hold it by reference, and
every upstream QUIC connection keeps raw pointers into it
(`QuicConnection::clock_`, each alarm's clock). When CDS removes the
cluster, the worker erases the thread-local cluster and `~ClusterEntry`
calls `drainConnPools()` with `DrainAndDelete`, which lets busy clients
finish their streams, and then destroys its members, including the info.
The pools live on in `host_http_conn_pool_map_` until their streams end,
with connections pointing into freed memory; the next write-ready event
or alarm reads the freed clock. It needs streams in flight at the
removal, so it is intermittent. `Http3ConnPoolImpl`'s destructor already
makes sure connections are torn down before the pool drops the info; the
cluster entry's ordering was the gap.

Fix: `PersistentQuicInfoPtr` becomes a `shared_ptr`, and
`Http3ConnPoolImpl`, `Http3::allocateConnPool` and `ConnectivityGrid`
take and hold it instead of a reference. The cluster keeps creating and
holding the info and passes its pointer to the pools, so the info lives
until the last pool using it is gone (a pool destroys its connections
first). `createQuicNetworkConnection` still takes a reference; it is
only called by a pool that holds the info. No behavior change on a
healthy path.

Testing:
`Http3ConnPoolImplTest.PoolKeepsPersistentQuicInfoAliveAfterItsCreatorReleasesIt`
creates the info as the cluster manager does, builds a pool on it and
releases the creator's reference: the info must stay alive while the
pool exists and be freed with it (fails without the fix: freed at
release). The HTTP/3 pool, connection grid, cluster manager and QUIC
client connection factory tests and the QUIC HTTP and multiplexed
integration tests pass. Found through a crash on a deployment that
removed HTTP/3 clusters under load; the fault was symbolized to the
clock read in `QuicConnection::CanWrite`.

Verified on main (after #47806): the new test and the HTTP/3 pool and
grid tests pass, and CI is green.

Risk Level: low
Testing: unit test (new), existing HTTP/3 pool, grid, cluster manager
and QUIC integration tests
Docs Changes: N/A
Release Notes: bug_fixes
Platform Specific Features: N/A

---------

Signed-off-by: Bruno Palermo <[email protected]>
fei-deng pushed a commit to envoyproxy/nighthawk that referenced this pull request Oct 20, 2026
…lrc (#1638)

* ci: write CI Bazel flags to user.bazelrc instead of removed repo.bazelrc

When #1627 synced .bazelrc with upstream Envoy PR envoyproxy/envoy#47806, it removed try-import %workspace%/repo.bazelrc from the bottom of .bazelrc. However, .github/workflows/_ci.yml still writes the CI compiler and resource configurations to repo.bazelrc, so Bazel no longer loads those settings during CI runs.

This PR replaces repo.bazelrc with user.bazelrc in .github/workflows/_ci.yml (and adds the upstream Envoy fallback in ci/do_ci.sh to copy repo.bazelrc to user.bazelrc if present), as user.bazelrc remains imported at the bottom of .bazelrc and ignored by .gitignore.

Signed-off-by: tomjzzhang <[email protected]>

* ci: trigger CI run 2 to verify stability

Signed-off-by: tomjzzhang <[email protected]>

* ci: trigger CI run 3 to verify stability

Signed-off-by: tomjzzhang <[email protected]>

---------

Signed-off-by: tomjzzhang <[email protected]>
fei-deng pushed a commit to envoyproxy/nighthawk that referenced this pull request Nov 23, 2026
…1654)

In Bzlmod (envoyproxy/envoy#47806), single_version_override declarations and dev_dependency module extensions in a non-root module (@envoy) are ignored by Bazel and only take effect in the root MODULE.bazel. Previously, Nighthawk's Envoy update process only synced bazel_dep versions, leaving Envoy's dependency overrides and shared module extensions out of sync.

This PR places Envoy's single_version_override dependencies in Nighthawk's root MODULE.bazel and updates both the automated updater script and manual update guide to keep single_version_override pins and shared module extensions synced with Envoy.

Signed-off-by: tomjzzhang <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants