-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The Linux platform KVS init should ignore multiple init calls #15963
The Linux platform KVS init should ignore multiple init calls #15963
Conversation
PR #15963: Size comparison from 2822511 to 0dab87c Increases (11 builds for linux)
Full report (26 builds for cyw30739, efr32, esp32, k32w, linux, nrfconnect, p6, telink)
|
@@ -53,6 +53,11 @@ CHIP_ERROR ChipLinuxStorage::Init(const char * configFile) | |||
{ | |||
CHIP_ERROR retval = CHIP_NO_ERROR; | |||
|
|||
if (mInitialized) | |||
{ | |||
return CHIP_NO_ERROR; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add a log here that we double-initialize.
Also check if configFile matches and if they do not, then we should error out instead of saying ok.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good points.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am going to simply log an error message for now, since returning an error causes ChipLinuxAppInit() to fail, which causes all example applications to fail.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should have failed when different config paths are specified, since there is no guarantee they are the same.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR #15963: Size comparison from 2822511 to cfd41f6 Increases (11 builds for linux)
Full report (26 builds for cyw30739, efr32, esp32, k32w, linux, nrfconnect, p6, telink)
|
cfd41f6
to
9f2e518
Compare
PR #15963: Size comparison from a69fde3 to 9f2e518 Increases (11 builds for linux)
Full report (26 builds for cyw30739, efr32, esp32, k32w, linux, nrfconnect, p6, telink)
|
Problem
The Linux KVS should ignore multiple calls to Init().
As an example, all Linux applications initialize the KVS (based on a custom provided path) in ChipLinuxAppInit(). Immediately following this, the KVS gets "re-initialized" in InitChipStack(), due to the change in #15741.
Ideally we will need to trace all Init() calls and ensure an application has just one such call, but that's probably a different story.
Change overview
Return from Init() safely if called again
Testing