RPC: Clear RTE Projects on ConvertSolution and LoadSolution#2486
Conversation
There was a problem hiding this comment.
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
LoadSolutionrequests. - Clear global RTE model projects before running
ConvertSolution. - Reset
m_solutionLoadedtofalseat the beginning ofLoadSolution/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.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 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
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Test Results 3 files - 4 21 suites - 32 13m 41s ⏱️ + 8m 0s 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. |
Fixes
Changes
Checklist