Skip to content

[Nexthop][fsdb] drop duplicate gflags DEFINE stat_publish_interval_ms - #1435

Open
saty-nexthop wants to merge 1 commit into
facebook:mainfrom
nexthop-ai:fsdb-dup-flag-fix
Open

[Nexthop][fsdb] drop duplicate gflags DEFINE stat_publish_interval_ms#1435
saty-nexthop wants to merge 1 commit into
facebook:mainfrom
nexthop-ai:fsdb-dup-flag-fix

Conversation

@saty-nexthop

@saty-nexthop saty-nexthop commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Pre-submission checklist

  • I've ran the linters locally and fixed lint errors related to the files I modified in this PR. You can install the linters by running pip install -r requirements-dev.txt && pre-commit install
  • pre-commit run

Summary

fboss/fsdb/server/Server.cpp defines stat_publish_interval_ms, and fboss/agent/AgentFeatures.cpp defines the same flag. Same name, same default, same help string. fsdb never reads it though. The only readers are HwAgentMain.cpp and SwAgentInitializer.cpp, and both pick it up from AgentFeatures.

That stays harmless right up until something links both objects into one binary. gflags hits ReportError(DIE, ...) on a second DEFINE of a flag it already has from a different file, and it does that inside the FlagRegisterer constructor, so the process dies in static init and never reaches main(). fsdb doesn't link agent_features today, so nobody has tripped it, but it's a trap for anything that touches fsdb's link line.

So drop the fsdb DEFINE/DECLARE. The agent copy stays, and it's the only one anyone reads.

One caveat worth flagging: fsdb parses with gflags::ParseCommandLineFlags, so --stat_publish_interval_ms on an fsdb command line is now an unknown-flag error. Nothing in the tree passes it to fsdb, and the flag did nothing for fsdb anyway, but if a config somewhere outside the repo sets it, that needs to go.

Test Plan

Grepped the flag after the change: four hits left, all agent side, none under fboss/fsdb. Built the cmake fsdb target, compiles and links. pre-commit run clean on both files.

fboss/fsdb/server/Server.cpp DEFINEs stat_publish_interval_ms with the
same name, default and help text as fboss/agent/AgentFeatures.cpp, and
Server.h DECLAREs it. Nothing under fboss/fsdb reads
FLAGS_stat_publish_interval_ms -- the only readers are agent side
(HwAgentMain.cpp, SwAgentInitializer.cpp) and they get the flag from
AgentFeatures. The fsdb copy is dead.

It is also a latent hard failure. gflags treats two DEFINEs of the same
flag name coming from different files as fatal:

  ERROR: flag 'stat_publish_interval_ms' was defined more than once
  (in files '...' and '...').

That is reported with DIE, from the FlagRegisterer constructor, so a
binary holding both definitions aborts during static initialization,
before main() ever runs. fsdb does not link agent_features today, so the
duplicate has stayed dormant, but any build that ends up with both
objects in the fsdb binary turns it into a startup crash loop that is
awkward to diagnose.

Remove the dead fsdb DEFINE/DECLARE. The agent side definition, which is
also the flag's only consumer, remains.
@saty-nexthop
saty-nexthop requested a review from a team as a code owner July 29, 2026 08:23
@meta-cla meta-cla Bot added the CLA Signed label Jul 29, 2026
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.

1 participant