Skip to content

[tests] clean up stale otbr-agent processes in ncp_mode runner#3386

Merged
jwhui merged 1 commit into
openthread:mainfrom
jwhui:fix/ncp-mode-stale-agent-cleanup
May 29, 2026
Merged

[tests] clean up stale otbr-agent processes in ncp_mode runner#3386
jwhui merged 1 commit into
openthread:mainfrom
jwhui:fix/ncp-mode-stale-agent-cleanup

Conversation

@jwhui
Copy link
Copy Markdown
Member

@jwhui jwhui commented May 29, 2026

Clean up any stale, orphan otbr-agent processes at the start of each expect script loop in the ncp_mode test runner.

Under POSIX expect test execution, the spawn command launches the otbr-agent as sudo (running as root). If the expect script exits, the child process can sometimes be orphaned instead of terminated. This leaves the otbr-agent alive on the host system and holding ownership of the io.openthread.BorderRouter.wpan0 D-Bus name.

In subsequent test scripts, the newly launched otbr-agent is unable to claim the D-Bus name, and all D-Bus requests are forwarded to the orphan otbr-agent process. Since its co-processor has been killed, the orphan agent hangs and subsequent .Join and properties Get method calls fail with a NoReply timeout.

Explicitly killing otbr-agent between test scripts prevents stale process leakage and resolves D-Bus communication timeouts.

gemini-code-assist[bot]

This comment was marked as outdated.

Clean up any stale, orphan `otbr-agent` processes at the start of
each expect script loop in the `ncp_mode` test runner.

Under POSIX expect test execution, the `spawn` command launches the
`otbr-agent` as `sudo` (running as root). If the expect script
exits, the child process can sometimes be orphaned instead of
terminated. This leaves the `otbr-agent` alive on the host system
and holding ownership of the `io.openthread.BorderRouter.wpan0`
D-Bus name.

In subsequent test scripts, the newly launched `otbr-agent` is
unable to claim the D-Bus name, and all D-Bus requests are
forwarded to the orphan `otbr-agent` process. Since its
co-processor has been killed, the orphan agent hangs and subsequent
`.Join` and properties `Get` method calls fail with a `NoReply`
timeout.

Explicitly killing `otbr-agent` between test scripts prevents
stale process leakage and resolves D-Bus communication timeouts.
@jwhui jwhui force-pushed the fix/ncp-mode-stale-agent-cleanup branch from 74eade2 to 6dfe367 Compare May 29, 2026 16:56
@jwhui
Copy link
Copy Markdown
Member Author

jwhui commented May 29, 2026

/gemini review

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the tests/scripts/ncp_mode script to ensure that the OTBR_AGENT process is terminated during cleanup alongside other OpenThread processes. There are no review comments to address, and I have no further feedback to provide.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 29, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 45.97%. Comparing base (2b41187) to head (6dfe367).
⚠️ Report is 1497 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3386      +/-   ##
==========================================
- Coverage   55.77%   45.97%   -9.81%     
==========================================
  Files          87      143      +56     
  Lines        6890    17236   +10346     
  Branches        0     1412    +1412     
==========================================
+ Hits         3843     7924    +4081     
- Misses       3047     8746    +5699     
- Partials        0      566     +566     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jwhui jwhui marked this pull request as ready for review May 29, 2026 17:31
@jwhui jwhui merged commit af13ba3 into openthread:main May 29, 2026
40 checks passed
@jwhui jwhui deleted the fix/ncp-mode-stale-agent-cleanup branch May 29, 2026 18:58
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.

2 participants