Fix race condition with concurrent teardown of ServiceCtx and re-connection of the preloaded Session Server.#512
Fix race condition with concurrent teardown of ServiceCtx and re-connection of the preloaded Session Server.#512smudri85 wants to merge 3 commits into
Conversation
|
Pull request must be merged with a description containing the required fields, Summary: If there is no jira releated to this change, please put 'Jira: NO-JIRA'. Description can be changed by editing the top comment on your pull request and making a new commit. |
There was a problem hiding this comment.
Pull request overview
Fixes a teardown-time race where ServiceContext can be destroyed while IPC callbacks trigger session-server recovery/reconnect logic, by introducing an explicit “shutting down” signal on ISessionServerAppManager and using it to gate restart/preload behavior.
Changes:
- Add
ISessionServerAppManager::setShuttingDown()and implement it inSessionServerAppManagerusing an atomic flag. - Mark the app manager as shutting down from
ServiceContext’s destructor to prevent restart/reconnect during teardown. - Add/extend unit tests around “skip restart when shutting down” and a destructor smoke test.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/unittests/serverManager/unittests/service/ServerManagerServiceTests.cpp | Adds a ServiceContext destructor smoke test and includes ServiceContext. |
| tests/unittests/serverManager/unittests/common/SessionServerAppManagerTestsFixture.h | Adds a trigger helper for the new shutdown flag. |
| tests/unittests/serverManager/unittests/common/SessionServerAppManagerTestsFixture.cpp | Implements the shutdown-flag trigger helper. |
| tests/unittests/serverManager/unittests/common/SessionServerAppManagerTests.cpp | Adds a test intended to verify restart is skipped during shutdown. |
| tests/unittests/serverManager/mocks/SessionServerAppManagerMock.h | Updates the mock interface to include setShuttingDown(). |
| serverManager/service/source/ServiceContext.cpp | Calls setShuttingDown() in ServiceContext destructor. |
| serverManager/service/include/ServiceContext.h | Changes destructor declaration; header is now directly included by new tests. |
| serverManager/common/source/SessionServerAppManager.h | Adds setShuttingDown() and switches shutdown flag to std::atomic_bool. |
| serverManager/common/source/SessionServerAppManager.cpp | Implements setShuttingDown() and uses shutdown flag to skip restart/preload; modifies shutdown path. |
| serverManager/common/include/ISessionServerAppManager.h | Extends the interface with setShuttingDown(). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Coverage statistics of your commit: |
|
Coverage statistics of your commit: |
Summary: Fix race condition with concurrent teardown of ServiceCtx and re-connection of the preloaded Session Server
Type: Fix
Test Plan: UT/CT, Fullstack
Jira: RDKEMW-19123