Skip to content

Remove dead config records from NetHandler - #13533

Merged
brbzull0 merged 3 commits into
apache:masterfrom
brbzull0:cleanup_nethandler_dead_records
Aug 13, 2026
Merged

Remove dead config records from NetHandler#13533
brbzull0 merged 3 commits into
apache:masterfrom
brbzull0:cleanup_nethandler_dead_records

Conversation

@brbzull0

Copy link
Copy Markdown
Contributor

Three proxy.config.net.* records have been unregistered since their introduction in 2015 , so their callbacks never fired and the struct fields they wrote were never read. Removing them shifts default_inactivity_timeout to index 2; the bitset selecting per-thread dependent values is unaffected since those members keep indices 0 and 1. Assertions now pin the field offsets and the bitset width, both of which were previously implicit.

Fixes: #12933

Three proxy.config.net.* records have been unregistered since their
introduction in 2015 (TS-3313), so their callbacks never fired and the
struct fields they wrote were never read. Removing them shifts
default_inactivity_timeout to index 2; the bitset selecting per-thread
dependent values is unaffected since those members keep indices 0 and 1.
Assertions now pin the field offsets and the bitset width, both of which
were previously implicit.

Fixes: apache#12933
@brbzull0
brbzull0 requested a balanced review from Copilot August 11, 2026 14:08
@brbzull0 brbzull0 self-assigned this Aug 11, 2026

Copilot AI 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.

Pull request overview

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Removes long-dead proxy.config.net.*_in configuration records from NetHandler and hardens assumptions about NetHandler::Config layout / per-thread-dependent config selection.

Changes:

  • Removed reads, update callbacks, and debug logging for three unregistered config records.
  • Updated NetHandler::Config to drop the unused fields and shift default_inactivity_timeout to index 2.
  • Added compile-time assertions for Config member offsets and for the per-thread-dependent mask used to initialize a std::bitset.

Reviewed changes

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

File Description
src/iocore/net/UnixNet.cc Centralizes the per-thread-dependent config mask and adds a compile-time guard before initializing the bitset.
src/iocore/net/NetHandler.cc Removes dead config reads / Rec callbacks / debug lines for unregistered records.
include/iocore/net/NetHandler.h Removes unused config fields and adds offsetof-based layout assertions for the array-like indexing contract.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/iocore/net/UnixNet.cc
Comment thread include/iocore/net/NetHandler.h
Damian Meden added 2 commits August 11, 2026 16:34
Address review feedback. Assert the standard layout and alignment that
offsetof and the array-like operator[] rely on, and replace the mask fit
check with std::bit_width so it does not depend on a shift that would be
ill formed if the field count ever reached the width of the shifted type.
The Ubuntu CI toolchain (clang 12) does not provide std::bit_width,
so the mask-width check broke the build there. Assert the mask fits
using a shift instead, guarded by a bit-width check so the shift
itself stays well defined.
@brbzull0
brbzull0 marked this pull request as ready for review August 12, 2026 06:56
Copilot AI review requested due to automatic review settings August 12, 2026 06:56

Copilot AI 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.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

Suppressed comments (1)

include/iocore/net/NetHandler.h:139

  • These assertions do not make Config safely indexable as an array. operator[] advances a pointer to one data member, and the update callback subtracts pointers to distinct members; both operations are undefined even when offsetof proves the members contiguous. Also, CONFIG_ITEM_COUNT can include tail padding because sizeof(Config) is not constrained here. Please represent the indexed values with std::array<uint32_t, 3> (or use explicit member-to-index mapping) so indexing and the bitset width are defined.
  // Config is addressed as an array of uint32_t through operator[], and
  // config_value_affects_per_thread_value is a bitset indexed by field
  // position, so the offset of each member is part of the interface.
  static_assert(std::is_standard_layout_v<Config>);    // required for offsetof below to be well defined
  static_assert(alignof(Config) == alignof(uint32_t)); // a member of wider type would break operator[]
  static_assert(offsetof(Config, max_connections_in) == 0 * sizeof(uint32_t));
  static_assert(offsetof(Config, max_requests_in) == 1 * sizeof(uint32_t));
  static_assert(offsetof(Config, default_inactivity_timeout) == 2 * sizeof(uint32_t));

@JosiahWI JosiahWI added this to the 11.0.0 milestone Aug 12, 2026

@JosiahWI JosiahWI 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.

Copilot is right that array-indexing into the config structure is UB, but that is out of scope here. Looks good.

@brbzull0

Copy link
Copy Markdown
Contributor Author

Copilot is right that array-indexing into the config structure is UB, but that is out of scope here. Looks good.

yes, there will be a follow up for that. Didn't want to mix it in here(although it may remove some of this code).

thanks.

@brbzull0
brbzull0 merged commit 66d8908 into apache:master Aug 13, 2026
15 checks passed
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.

Clean up dead config records in NetHandler

3 participants