Skip to content

RDKB-66812 RDKB-66844 : Pause Network Intelligence while speedtest is running - #103

Merged
GoutamD2905 merged 20 commits into
developfrom
feature/RDKB-66844
Sep 28, 2026
Merged

GoutamD2905 merged 20 commits into
developfrom
feature/RDKB-66844

Conversation

@akumar0702

@akumar0702 akumar0702 commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

Reason for change: To pause Network Intelligence while speed test is running
Test Procedure: Trigger speed test and confirm if NI pauses on ST_TR181_STATUS_STARTING event
and resumes on ST_TR181_STATUS_COMPLETE event
Risks: Low
Priority: P0

Signed-off-by: santhosh_gujulvajagadeesh@comcast.com

Test Procedure:
Risks: Low
Signed-off-by: arunkumar_nagulapally@comcast.com
Copilot AI lite review requested due to automatic review settings September 9, 2026 18:16
@akumar0702
akumar0702 requested review from a team as code owners September 9, 2026 18:16

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.

🟡 Changes recommended

It introduces a real exit-status handling bug in the new C handler (unsafe WEXITSTATUS usage), plus security/logging/test coverage issues that should be addressed before approval.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds SpeedTest status handling to pause/resume Network Intelligence (cujo-qosd) during SpeedTest runs, wiring an RBUS event into existing AdvSecurity control flows and extending the startup script accordingly.

Changes:

  • Subscribe to Device.IP.Diagnostics.X_RDKCENTRAL-COM_SpeedTest.Status and handle status transitions to trigger NI pause/resume.
  • Add -speedtestNIStart / -speedtestNIComplete actions to start_adv_security.sh, including an auto-unpause timer.
  • Add unit tests validating the new SpeedTest status handler behavior.
File summaries
File Description
source/test/CcspAdvSecurityDmlTest/CcspAdvSecurityInternalTest.cpp Adds unit tests for the SpeedTest status RBUS event handler.
source/AdvSecurityDml/cosa_adv_security_internal.c Subscribes to SpeedTest status RBUS event and triggers NI pause/resume via script calls.
scripts/start_adv_security.sh Implements NI pause/resume actions and a timer mechanism for automatic re-enable.
Review details

Suppressed comments (1)

source/AdvSecurityDml/cosa_adv_security_internal.c:478

  • Same issue as above: WEXITSTATUS(rc) is evaluated even when !WIFEXITED(rc) is true. Guard WEXITSTATUS behind a successful WIFEXITED check.
        rc = v_secure_system(TEMP_DOWNLOAD_LOCATION"/usr/ccsp/advsec/start_adv_security.sh -speedtestNIComplete &");
        if (!WIFEXITED(rc) || WEXITSTATUS(rc) != 0)
        {
            CcspTraceError(("%s: failed to enable cujo-qosd for SpeedTest, rc=%d\n", __FUNCTION__, WEXITSTATUS(rc)));
        }
  • Files reviewed: 3/3 changed files
  • Comments generated: 4
  • Review effort level: Lite

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

Comment thread scripts/start_adv_security.sh Outdated
Comment thread scripts/start_adv_security.sh Outdated
Comment thread source/AdvSecurityDml/cosa_adv_security_internal.c Outdated
Comment thread source/test/CcspAdvSecurityDmlTest/CcspAdvSecurityInternalTest.cpp
Copilot AI review requested due to automatic review settings September 15, 2026 18:59

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.

🟡 Changes recommended

Unresolved critical and moderate issues affect event ordering, test behavior, and timer/status handling.

Get a fresh assessment by requesting another Copilot review.

Review details

Suppressed comments (6)

Previously missed (1) — in code that hasn't changed since the last review.

scripts/start_adv_security.sh:623

  • The timer PID file is never removed when this background timer expires normally. On a later speed-test event, a stale PID can have been reused by an unrelated process, so speedtest_cancel_networkintelligence_timer may send SIGTERM to that process. Clean up the file when the timer exits, but only if it still contains this timer's PID.

scripts/start_adv_security.sh:595

  • The subscribed status object is Device.IP.Diagnostics.X_RDKCENTRAL-COM_SpeedTest (cosa_adv_security_internal.c:69), but this lookup uses X_RDK_SpeedTest. On devices exposing only the subscribed object, dmcli will return an invalid/non-numeric value and the pause path will exit without disabling cujo-qosd.
    unpause_timeout=$(dmcli eRT retv "Device.IP.Diagnostics.X_RDK_SpeedTest.SubscriberUnPauseTimeOut" 2>/dev/null)

source/AdvSecurityDml/cosa_adv_security_internal.c:462

  • This log evaluates WEXITSTATUS(rc) even when the preceding condition is true because WIFEXITED(rc) is false. WEXITSTATUS is only meaningful for a normally exited child, so signal/-1 failures will be logged with a fabricated status; guard the extraction or log the raw return value in that case.
            CcspTraceError(("%s: failed to disable cujo-qosd for SpeedTest, rc=%d\n", __FUNCTION__, WEXITSTATUS(rc)));

source/AdvSecurityDml/cosa_adv_security_internal.c:471

  • This log evaluates WEXITSTATUS(rc) even when the preceding condition is true because WIFEXITED(rc) is false. WEXITSTATUS is only meaningful for a normally exited child, so signal/-1 failures will be logged with a fabricated status; guard the extraction or log the raw return value in that case.
            CcspTraceError(("%s: failed to enable cujo-qosd for SpeedTest, rc=%d\n", __FUNCTION__, WEXITSTATUS(rc)));

source/test/CcspAdvSecurityDmlTest/CcspAdvSecurityInternalTest.cpp:1477

  • This expectation has the same accessor mismatch: the handler invokes rbusValue_GetUInt32, not rbusValue_GetString. The status-5 test therefore fails on an unexpected mock call before verifying the completion command.
    EXPECT_CALL(*g_rbusMock, rbusValue_GetString(value, _))
        .Times(1)
        .WillOnce(Return("5"));

source/test/CcspAdvSecurityDmlTest/CcspAdvSecurityInternalTest.cpp:1509

  • This no-action test also stubs rbusValue_GetString, while the implementation calls rbusValue_GetUInt32; Google Mock will fail on the unexpected accessor instead of exercising the status-2 path.
    EXPECT_CALL(*g_rbusMock, rbusValue_GetString(value, _))
        .Times(1)
        .WillOnce(Return("2"));
  • Files reviewed: 3/3 changed files
  • Comments generated: 2
  • Review effort level: Lite

Comment thread source/AdvSecurityDml/cosa_adv_security_internal.c Outdated
Comment thread source/test/CcspAdvSecurityDmlTest/CcspAdvSecurityInternalTest.cpp Outdated
Copilot AI review requested due to automatic review settings September 16, 2026 15:54

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.

🟡 Changes recommended

Unresolved moderate findings affect timeout ordering, recovery, clock handling, command failure handling, and test coverage.

Get a fresh assessment by requesting another Copilot review.

Review details

Suppressed comments (2)

source/AdvSecurityDml/cosa_adv_security_internal.c:496

  • This deadline is based on CLOCK_REALTIME, which is also the default clock for this condition variable. An NTP or manual wall-clock correction can therefore make the timeout fire early or be postponed indefinitely, enabling qosd while the speed test is still running or leaving it disabled. Use a condition variable configured for CLOCK_MONOTONIC and compute the deadline from that clock.
    if (clock_gettime(CLOCK_REALTIME, &deadline) != 0)
    {
        CcspTraceError(("%s: clock_gettime failed, errno=%d\n", __FUNCTION__, errno));
        return FALSE;
    }
    deadline.tv_sec += timeout;

source/AdvSecurityDml/cosa_adv_security_internal.c:587

  • Because this command is backgrounded, v_secure_system only observes the shell that queued start_adv_security.sh, not the cujo-ni-cli operation performed by the script. A failure to disable qosd therefore usually looks like success here, so the timer is left armed and the speed test can run with qosd still enabled. Run this operation synchronously or add an asynchronous result/retry path before treating the start as successful.
        rc = v_secure_system(TEMP_DOWNLOAD_LOCATION"/usr/ccsp/advsec/start_adv_security.sh -speedtestNIStart &");
        if (!WIFEXITED(rc) || WEXITSTATUS(rc) != 0)
  • Files reviewed: 3/3 changed files
  • Comments generated: 3
  • Review effort level: Lite

Comment thread source/AdvSecurityDml/cosa_adv_security_internal.c Outdated
Comment thread source/AdvSecurityDml/cosa_adv_security_internal.c Outdated
Comment thread source/test/CcspAdvSecurityDmlTest/CcspAdvSecurityInternalTest.cpp
Copilot AI review requested due to automatic review settings September 22, 2026 09:26

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.

Comment thread source/AdvSecurityDml/cosa_adv_security_internal.c Outdated
Comment thread source/AdvSecurityDml/cosa_adv_security_internal.c
Copilot AI review requested due to automatic review settings September 22, 2026 11:16

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.

Copilot review overview

🔵 Needs a closer look

Unresolved moderate findings affect QoS synchronization, timeout handling, error handling, RBUS initialization, and test coverage.

Review effort: Lite
Findings: 4 Medium severity

Open (4)

Copilot AI review requested due to automatic review settings September 22, 2026 16:27

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.

Comment thread source/AdvSecurityDml/Makefile.am
Comment thread source/AdvSecurityDml/cosa_adv_security_internal.c
Comment thread source/AdvSecurityDml/cosa_adv_security_internal.c
Comment thread source/test/CcspAdvSecurityDmlTest/CcspAdvSecurityInternalTest.cpp
Copilot AI review requested due to automatic review settings September 22, 2026 16:50
Copilot AI review requested due to automatic review settings September 23, 2026 16:02

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.

Copilot review overview

🟡 Changes recommended

Address the RBUS value leak and prevent late QoS re-enablement after NI deactivation.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 Medium severity

Open (1)

Comment thread source/AdvSecurityDml/cosa_adv_security_internal.c
Copilot AI review requested due to automatic review settings September 23, 2026 16:17

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.

Copilot review overview

🟡 Changes recommended

A critical completion-event issue can leave qosd paused until timeout when NI is deactivated during a speed test.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 High severity

Open (1)
Resolved since last review (1)

Comment thread source/AdvSecurityDml/cosa_adv_security_internal.c
Copilot AI review requested due to automatic review settings September 26, 2026 17:08

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.

Copilot review overview

🔵 Needs a closer look

Resolve the race that can lose a new SpeedTest pause cycle during worker cleanup.

Review effort: Lite
Findings: None

Resolved since last review (1)

Copilot AI review requested due to automatic review settings September 28, 2026 04:58

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.

Copilot review overview

🔵 Needs a closer look

A moderate race can cause back-to-back SpeedTests to lose the new pause operation.

Review effort: Lite
Findings: None

Copilot AI review requested due to automatic review settings September 28, 2026 05:08

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.

Copilot review overview

🔵 Needs a closer look

The changes affect runtime NI state and event-driven timer behavior, warranting final human review.

Review effort: Lite
Findings: None

Copilot AI review requested due to automatic review settings September 28, 2026 05:50

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.

Comment thread source/AdvSecurityDml/cosa_adv_security_internal.c
Comment thread source/AdvSecurityDml/cosa_adv_security_internal.c
Comment thread source/AdvSecurityDml/cosa_adv_security_internal.c
Comment thread source/AdvSecurityDml/cosa_adv_security_internal.c
Comment thread source/test/CcspAdvSecurityDmlTest/CcspAdvSecurityInternalTest.cpp
Comment thread source/test/CcspAdvSecurityDmlTest/CcspAdvSecurityInternalTest.cpp
Comment thread source/test/CcspAdvSecurityDmlTest/CcspAdvSecurityInternalTest.cpp
Comment thread source/AdvSecurityDml/cosa_adv_security_internal.h

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

@GoutamD2905
GoutamD2905 merged commit 100dcbd into develop Sep 28, 2026
13 of 14 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Sep 28, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants