Skip to content

RPC: Clear RTE Projects on ConvertSolution and LoadSolution#2486

Merged
edriouk merged 3 commits into
mainfrom
ClearModelOnSolutionLoad
May 21, 2026
Merged

RPC: Clear RTE Projects on ConvertSolution and LoadSolution#2486
edriouk merged 3 commits into
mainfrom
ClearModelOnSolutionLoad

Conversation

@edriouk
Copy link
Copy Markdown
Contributor

@edriouk edriouk commented May 21, 2026

Fixes

  • Current implementation creates new RTE projects for each ConvertSolution and LoadSolution and does not dispose them until termination.

Changes

  • Clear RTE Projects on ConvertSolution and LoadSolution RPC calls

Checklist

  • 🤖 This change is covered by unit tests (if applicable).
  • 🤹 Manual testing has been performed (if necessary).
  • 🛡️ Security impacts have been considered (if relevant).
  • 📖 Documentation updates are complete (if required).
  • 🧠 Third-party dependencies and TPIP updated (if required).

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 addresses an RPC-session resource growth issue where repeated LoadSolution / ConvertSolution calls can accumulate RteProject instances in the global RTE model until process termination. It does so by clearing RTE projects at the start of those RPC flows while keeping packs loaded.

Changes:

  • Clear global RTE model projects before processing LoadSolution requests.
  • Clear global RTE model projects before running ConvertSolution.
  • Reset m_solutionLoaded to false at the beginning of LoadSolution / ConvertSolution.
Comments suppressed due to low confidence (2)

tools/projmgr/src/ProjMgrRpcServer.cpp:330

  • LoadSolution clears existing state (m_solutionLoaded=false and GlobalModel->ClearProjects()) before validating the solution filename. If the argument fails the extension check, the method returns early but the previously loaded solution is now unusable and all projects are deleted. Consider moving the state reset/ClearProjects() to after the filename validation (and ideally only when proceeding with a new load attempt), so invalid inputs don’t wipe the current session state.

This issue also appears on line 322 of the same file.

RpcArgs::SuccessResult RpcHandler::LoadSolution(const string& solution, const string& activeTarget) {
  m_bUseAllPacks = false; // loading solution will first use only listed packs
  m_packReferences.clear(); // will be updated
  m_solutionLoaded = false; // assume not loaded yet
  // clear only projects, global RTE data and packs stay loaded
  ProjMgrKernel::Get()->GetGlobalModel()->ClearProjects();
  RpcArgs::SuccessResult result = {false};
  const auto csolutionFile = RteFsUtils::MakePathCanonical(solution);
  if(!regex_match(csolutionFile, regex(".*\\.csolution\\.(yml|yaml)"))) {
    result.message = solution + " is not a *.csolution.yml file";
    return result;
  }

tools/projmgr/src/ProjMgrRpcServer.cpp:324

  • The comment says this clears “projects, global RTE data” (or “RTE data”), but the code only calls GlobalModel->ClearProjects(), which removes projects but does not clear the rest of the global model. Please either adjust the comment to match the actual behavior, or call the appropriate clear method(s) if additional model state really needs to be reset.
  m_solutionLoaded = false; // assume not loaded yet
  // clear only projects, global RTE data and packs stay loaded
  ProjMgrKernel::Get()->GetGlobalModel()->ClearProjects();

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tools/projmgr/src/ProjMgrRpcServer.cpp Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented May 21, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 65.24%. Comparing base (bbc48bf) to head (4c8b12a).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2486   +/-   ##
=======================================
  Coverage   65.23%   65.24%           
=======================================
  Files         147      147           
  Lines       26662    26666    +4     
  Branches    16157    16159    +2     
=======================================
+ Hits        17393    17397    +4     
  Misses       7074     7074           
  Partials     2195     2195           
Flag Coverage Δ
projmgr-cov 87.93% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
tools/projmgr/src/ProjMgrRpcServer.cpp 85.61% <100.00%> (+0.09%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions
Copy link
Copy Markdown

Test Results

    3 files   -   4     21 suites   - 32   13m 41s ⏱️ + 8m 0s
  464 tests +279    464 ✅ +296  0 💤  - 17  0 ❌ ±0 
1 392 runs  +700  1 392 ✅ +768  0 💤  - 68  0 ❌ ±0 

Results for commit 4c8b12a. ± Comparison against base commit bbc48bf.

This pull request removes 185 and adds 464 tests. Note that renamed tests count towards both.
AuxCmdTests ‑ MkdirCmdTest
AuxCmdTests ‑ RmdirCmdTest
AuxCmdTests ‑ TouchCmdTest
BuildSystemGeneratorTests ‑ GenAuditFile
BuildSystemGeneratorTests ‑ GenAuditFile_WithOut_Existing_Audit_File
BuildSystemGeneratorTests ‑ GenAuditFile_With_Existing_Audit_File
BuildSystemGeneratorTests ‑ GetString
BuildSystemGeneratorTests ‑ StrConv
BuildSystemGeneratorTests ‑ StrNorm
CBuildGCCTests ‑ Asm
…
ProjMgrGeneratorUnitTests ‑ DryRun
ProjMgrGeneratorUnitTests ‑ DryRunIncapableGenerator
ProjMgrGeneratorUnitTests ‑ DryRunNoLdScript
ProjMgrGeneratorUnitTests ‑ EmptyCprjElements
ProjMgrGeneratorUnitTests ‑ FailCreatingDirectories
ProjMgrGeneratorUnitTests ‑ GenDir
ProjMgrGeneratorUnitTests ‑ GenFiles
ProjMgrGeneratorUnitTests ‑ GetLocalTimestamp
ProjMgrGeneratorUnitTests ‑ GetStringFromVector
ProjMgrGeneratorUnitTests ‑ NoExeFiles
…

@edriouk edriouk requested a review from brondani May 21, 2026 14:46
Copy link
Copy Markdown
Collaborator

@brondani brondani left a comment

Choose a reason for hiding this comment

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

LGTM

@edriouk edriouk merged commit 849db6d into main May 21, 2026
33 checks passed
@edriouk edriouk deleted the ClearModelOnSolutionLoad branch May 21, 2026 14:54
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.

3 participants