Skip to content

Fixing sonic-buildimage failures due to PR#1906 - #1942

Closed
sivat6 wants to merge 12 commits into
sonic-net:masterfrom
sivat6:master
Closed

Fixing sonic-buildimage failures due to PR#1906#1942
sivat6 wants to merge 12 commits into
sonic-net:masterfrom
sivat6:master

Conversation

@sivat6

@sivat6 sivat6 commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Description of PR

Noticed the following error logs in syncd.

2026 Jun 15 06:51:58.579634 vlab-01 ERR syncd#syncd: :- run: select failed: 2

Summary:
Fixes #
processPendingDampingSync() was directly sending notifications via m_notifications->send() which might affect the fd that select() is managing resulted in inconsistent state.

Introduced a queue with mutex protection. processPendingDampingSync() enqueues the notifications and flushPendingDampingNotifications() dequeues and sends in main thread.

Type of change

  • Bug fix

Approach

What is the motivation for this PR?

Build issue in sonic-buildimage

Work item tracking

None

How did you do it?

The processPendingDampingSync() just enqueues the notifications. Later flushPendingDampingNotifications() dequeues and sends in main thread.

How did you verify/test it?

Unit Testing done. Without the fix, I can see the run:select_failed messages every 1 sec. After the fix, I am not seeing this error logs.

Any platform specific information?

None

Documentation

None

@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@sivat6 sivat6 changed the title Fixing the Elastictest failures due to PR# 1906 Fixing sonic-buildimage Elastictest failures due to PR#1906 Jun 16, 2026

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

Can you add UT to your change?

@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@sivat6 sivat6 changed the title Fixing sonic-buildimage Elastictest failures due to PR#1906 Fixing sonic-buildimage failures due to PR#1906 Jun 18, 2026
@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

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

This PR updates syncd link event damping handling to avoid sending port state change notifications directly from the damping-sync path, instead queuing them and flushing/sending from the main Syncd::run() loop. This aims to prevent select()-loop instability observed in sonic-buildimage builds and improves robustness of notification delivery timing.

Changes:

  • Introduce a mutex-protected pending-notifications queue in Syncd, with processPendingDampingSync() enqueueing and a new flushPendingDampingNotifications() sending from the main thread.
  • Update the main Syncd::run() loop to explicitly handle Select::TIMEOUT/ERROR/SIGNALINT and flush queued damping notifications in a controlled place.
  • Add/extend unit tests covering enqueueing, overflow behavior, flush behavior, and integrated flow; add required build flags for private-member inspection in syncd unit tests.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 7 comments.

File Description
syncd/Syncd.cpp Implements enqueue+flush notification flow and adjusts the main select loop control flow.
syncd/Syncd.h Adds pending notification queue + mutex and declares the new flush method.
unittest/syncd/TestSyncd.cpp Adds unit tests for the new queue/flush behavior and fixes constexpr linkage.
unittest/syncd/Makefile.am Adds -fno-access-control to support tests inspecting internal Syncd state.

Comment thread syncd/Syncd.cpp
Comment thread syncd/Syncd.cpp
Comment thread unittest/syncd/TestSyncd.cpp Outdated
Comment thread unittest/syncd/TestSyncd.cpp
Comment thread unittest/syncd/TestSyncd.cpp Outdated
Comment thread unittest/syncd/TestSyncd.cpp Outdated
Comment thread unittest/syncd/TestSyncd.cpp Outdated

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

Please fix the concerns about code quality from previous PR: #1906 that is also observed in this PR.

@linux-foundation-easycla

Copy link
Copy Markdown

CLA Not Signed

@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@linux-foundation-easycla

Copy link
Copy Markdown

CLA Not Signed

@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@linux-foundation-easycla

Copy link
Copy Markdown

CLA Not Signed

@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

lolyu and others added 12 commits June 22, 2026 13:22
…c-net#1912)

What I did
Added handling for SAI_OBJECT_TYPE_METER_BUCKET_ENTRY in meta/MetaKeyHasher.cpp:

operator== overload for sai_meter_bucket_entry_t comparing (switch_id, eni_id, meter_class).
sai_get_hash for the same struct.
case in the extension switch of both MetaKeyHasher::operator() (hash) and MetaKeyHasher::operator() (equality).
Unit test MetaKeyHasher.operator_eq_meter_bucket_entry in unittest/meta/TestMetaKeyHasher.cpp.
Why I did it
MetaKeyHasher::operator() / operator== are the hasher/comparator used by the unordered containers keyed by sai_object_meta_key_t inside meta/Meta.cpp (e.g. m_saiObjectCollection). Any meta-key whose object type isn't enumerated in the two switch statements falls through to SWSS_LOG_THROW("not handled: ...").

SAI_OBJECT_TYPE_METER_BUCKET_ENTRY is a DASH extension entry type already supported by sai_serialize_meter_bucket_entry / sai_deserialize_meter_bucket_entry in meta/SaiSerialize.cpp, but it was never added to the hasher. As a result, unit tests Meta.quad_mcast_fdb_entry and Meta.quad_impc_entry started failing with:

:- operator(): not handled: SAI_OBJECT_TYPE_METER_BUCKET_ENTRY
when the meta layer iterated extension entry metadata while validating create/get/remove on mcast_fdb / ipmc entries. The companion test Meta.remove_meter_bucket_entry passes because its code path does not exercise the hasher branch.

How I verified it
New unit test MetaKeyHasher.operator_eq_meter_bucket_entry exercises both operator() overloads (hash + equality) with SAI_OBJECT_TYPE_METER_BUCKET_ENTRY keys.
Existing meta unit tests Meta.quad_mcast_fdb_entry / Meta.quad_impc_entry should now pass on CI.
Details if related
Hash is computed from (eni_id, meter_class), matching the pattern used for other extension entries such as SAI_OBJECT_TYPE_ENI_TRUSTED_VNI_ENTRY. switch_id is intentionally not folded into the hash (consistent with other entry hashers) but is included in the equality check.

Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>
* Adding link event damping support

Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>

* Revert "Adding link event damping support"

This reverts commit 0953e68.

Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>

* Adding link event damping support

Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>

* Addressing review comments

Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>

* Wrongly checked !=0 instead of ==0

Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>

* Fixing indentation issues

Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>

* Fix build errors

Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>

* Fixing build error

Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>

* Fixing unit test failure

Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>

* Fixing white space error and missing SWSS_LOG_ENTER

Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>

* Fixing dpkg dependency problems for libswsscommon

Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>

* Removing my changes in build-template.yml file

Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>

* Fixing spell check failures

Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>

* Removing the fix added to build-swss-template.yml

Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>

* Adding more test cases to increase coverage

Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>

* Fixing the failed UT case

Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>

* Fixing the typo in the last commit

Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>

* Removing few test cases

Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>

* Removing similar tests

Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>

* Removing the notification from timer thread to main thread

Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>

* Test purpose to see PR# 1925 fixes current build issue

Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>

* Remove the code of PR# 1925

Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>

* Fixing build issue

Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>

* SWSS_LOG_ENTER missed in new API

Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>

* Adding suppress and reuse threshold invalid config check

Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>

* Adding tests to increase coverage

Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>

* Added SWSS_LOG_ENTER() in the APIs in test file

Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>

* Addressed review comments

Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>

* Addressed code review comments

Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>

* Adding tests under unittest and removing the unnecessary tests from syncd/tests/TestSyncdLinkEventDamping.cpp

Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>

* Trigger pipeline

Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>

* Adding SWSS_LOG_ENTER()

Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>

* Debugging the test case

Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>

* Tweaking some timing value in one test

Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>

* Tweaking params

Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>

---------

Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>
…cd::run()

Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>
Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>
Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>
Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>
Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>
Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>
Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>
Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>
Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>
Signed-off-by: Sivakumar Thirukkanna Thevar <sthirukkanna@juniper.net>
@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines will not run the associated pipelines, because the pull request was updated after the run command was issued. Review the pull request again and issue a new run command.

@sivat6 sivat6 closed this Jun 22, 2026
@sivat6

sivat6 commented Jun 22, 2026

Copy link
Copy Markdown
Contributor Author

New PR Opened,

#1948

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.

5 participants