Skip to content

Commit 1642396

Browse files
kpschoedelpull[bot]
authored andcommitted
Fix _InitChipStack() initialization order. (#11374)
#### Problem `ConfigurationMgr().Init()` indirectly uses the System layer, which has not yet been initialized, in its ‘fail-safe armed’ case. Fixes #5336 TestPlatformMgr occasionally crashes on Linux #### Change overview Initialize Configuration Manager after the System layer. #### Testing Confirmed on Linux that adding `fail-safe-armed=1` to `/tmp/chip_config.ini` reliably triggers the `TestPlatformMgr` crash on master, but not after this change. Relying on CI to confirm that there are no unexpected side effects of changing the initialization order. (There should be none, since System::Layer does not depend on ConfigurationMgr.)
1 parent 8d3a96c commit 1642396

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

src/include/platform/internal/GenericPlatformManagerImpl.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,18 +64,19 @@ CHIP_ERROR GenericPlatformManagerImpl<ImplClass>::_InitChipStack()
6464
}
6565
SuccessOrExit(err);
6666

67-
err = ConfigurationMgr().Init();
67+
// Initialize the CHIP system layer.
68+
err = SystemLayer().Init();
6869
if (err != CHIP_NO_ERROR)
6970
{
70-
ChipLogError(DeviceLayer, "Configuration Manager initialization failed: %s", ErrorStr(err));
71+
ChipLogError(DeviceLayer, "SystemLayer initialization failed: %s", ErrorStr(err));
7172
}
7273
SuccessOrExit(err);
7374

74-
// Initialize the CHIP system layer.
75-
err = SystemLayer().Init();
75+
// Initialize the Configuration Manager.
76+
err = ConfigurationMgr().Init();
7677
if (err != CHIP_NO_ERROR)
7778
{
78-
ChipLogError(DeviceLayer, "SystemLayer initialization failed: %s", ErrorStr(err));
79+
ChipLogError(DeviceLayer, "Configuration Manager initialization failed: %s", ErrorStr(err));
7980
}
8081
SuccessOrExit(err);
8182

0 commit comments

Comments
 (0)