Skip to content

bm_sim: fix spurious duplicate ageing notifications for entries that remain aged across sweeps - #1443

Open
Devansh-567 wants to merge 1 commit into
p4lang:mainfrom
Devansh-567:fix-spurious-ageing-notifications
Open

bm_sim: fix spurious duplicate ageing notifications for entries that remain aged across sweeps#1443
Devansh-567 wants to merge 1 commit into
p4lang:mainfrom
Devansh-567:fix-spurious-ageing-notifications

Conversation

@Devansh-567

Copy link
Copy Markdown
Contributor

Summary

PR fixes an issue where AgeingMonitor::do_sweep() sends duplicate ageing notifications to the controller on subsequent sweeps for entries that are still aged and untreated.

Problem

prev_sweep_entries keeps track of entry handles reported in the previous sweep so we don't re-notify the controller. However, prev_sweep_entries was getting cleared every sweep and only populated inside if (!entries.empty()). If a sweep didn't discover any new aged entries, entries was empty so prev_sweep_entries was left empty too. On the next sweep, any existing aged entry was treated as new again, causing duplicate notifications every other sweep. Also, AgeingTest.NoDuplicate wasn't catching this because the blocking read() call accidentally allowed timing gaps that masked the duplicate messages.

Fix

  • Updated prev_sweep_entries to record all currently aged entries (entries_tmp) on every sweep, even when no new entries aged out.
  • Changed AgeingTest.NoDuplicate to poll check_status() without blocking over 4 sweep intervals to make sure zero duplicate notifications are sent.

Testing

  • Confirmed AgeingTest.NoDuplicate fails on the unpatched code and passes with this fix.
  • Ran test_ageing and NotificationsTest.Ageing in test_bm_apps locally, all passing.

Signed-off-by: Devansh-567 <devansh.jay.singh@gmail.com>
@Devansh-567
Devansh-567 force-pushed the fix-spurious-ageing-notifications branch from 8c5acf3 to f604d32 Compare August 21, 2026 04:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant