-
Notifications
You must be signed in to change notification settings - Fork 852
Description
While doing some other work I found out that some records in the nethandler are dead. Asked Claude to investigate and came up with the following
Three proxy.config.net.* records in NetHandler have been dead code since their introduction in 2015 (TS-3313, commit 974e8e3). They were never registered in RecordsConfig.cc, are not documented, and the config values they store are never consumed by any functional code.
Affected records
| Record | Registered in RecordsConfig.cc? |
Read by any logic? |
|---|---|---|
proxy.config.net.inactive_threshold_in |
❌ No | ❌ No |
proxy.config.net.transaction_no_activity_timeout_in |
❌ No | ❌ No |
proxy.config.net.keep_alive_no_activity_timeout_in |
❌ No | ❌ No |
What exists today
Each record has plumbing that compiles and is structurally reachable, but is dead in practice:
-
Config struct fields in
NetHandler.hL116-L118 — defined but never read by any functional code. -
RecGetRecordInt()reads inNetHandler.ccL180-L184 — always return0viavalue_or(0)since the records don't exist inRecordsConfig.cc. -
RecRegisterConfigUpdateCb()callbacks inNetHandler.ccL201-L203 — register callbacks on non-existent records, so they can never fire. -
Handler branches in
NetHandler.ccL131-L139 — would write to the config fields if the callbacks fired, but they can't (see point 3), and even if they could, no code reads the stored values. -
Debug log lines in
NetHandler.ccL210-L214 — always log0.
History
- 2015 — TS-3313 (974e8e3): Introduced all three records (with
inactive_threashold_intypo) inUnixNet.ccwithREC_ReadConfigInt32()andRecRegisterConfigUpdateCb(), but forgot to add them toRecordsConfig.cc. Onlymax_connections_inandmax_connections_active_inwere added to the config table. - 2017 — 69343fe: Refactored NetHandler init to be static. Fixed typo
inactive_threashold_in→inactive_threshold_in. Carried forward the same unregistered records. - Present — Records remain unregistered and unused.
Not related to the http variants
There are similarly-named records in the HTTP layer that are properly registered and functional:
proxy.config.http.keep_alive_no_activity_timeout_in— registered inRecordsConfig.ccL471, used byHttpConfig.cc/HttpSM.ccproxy.config.http.transaction_no_activity_timeout_in— registered inRecordsConfig.ccL479, used byHttpConfig.cc/HttpSM.cc
These are separate records serving different purposes in the HTTP layer — no replacement or renaming occurred.
Proposed fix
Remove the dead plumbing for all three records:
- Remove the three fields from
Configstruct inNetHandler.h - Remove the
RecGetRecordInt()calls inNetHandler.ccinit_for_process() - Remove the
RecRegisterConfigUpdateCb()calls inNetHandler.ccinit_for_process() - Remove the handler branches in
NetHandler.ccupdate_nethandler_config() - Remove the
Dbg()lines inNetHandler.ccinit_for_process() - Verify
Configstruct index arithmetic (updated_member - &global_config[0]) still works correctly after removing fields, sinceconfig_value_affects_per_thread_valueis a bitset indexed by struct field position