Skip to content
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

Cannot commission multiple Matter instances in a single Linux node #13429

Closed
selissia opened this issue Jan 10, 2022 · 5 comments
Closed

Cannot commission multiple Matter instances in a single Linux node #13429

selissia opened this issue Jan 10, 2022 · 5 comments
Assignees

Comments

@selissia
Copy link
Contributor

selissia commented Jan 10, 2022

Problem

Cannot commission multiple Matter instances in a single Linux node. Once the first node (a Linux process) is commissioned the subsequent chip-tool pairing command does not attempt to communicate with the second node (another Linux process in the same node). If one issues rm -r /tmp/chip_* before starting the second node then the second commissioning works -- but this results in two nodes being commissioned to different fabrics.

This scenario used to work on Linux in December 2021. This scenario seems to still be working correctly on Darwin.

Steps to reproduce:

scripts/examples/gn_build_example.sh examples/chip-tool out/ && scripts/examples/gn_build_example.sh examples/ota-provider-app/linux out/debug chip_config_network_layer_ble=false  && scripts/examples/gn_build_example.sh examples/ota-requestor-app/linux out/debug

./out/debug/chip-ota-provider-app -f /tmp/ota.txt
./out/chip-tool pairing onnetwork 1 20202021
./out/debug/chip-ota-requestor-app -u 5560 -d 42 
./out/chip-tool pairing onnetwork-long 2 20202021 42

Proposed Solution

@selissia
Copy link
Contributor Author

selissia commented Jan 13, 2022

Functionality broken by this commit: 360252c

Reverting the change in src/app/server/Server.cpp makes the issue go away.

@selissia
Copy link
Contributor Author

selissia commented Jan 17, 2022

The logic introduced in the above commit is not correct: It assumes that from GetFabricTable().FabricCount() != 0 it follows that the device is commissioned. This isn't the case: fabric count would be non-zero if the device simply loads the fabric table from storage upon init -- this does not guarantee that the device is commissioned.

The reason that the Darwin platform is working is most likely that it does not implement storage and FabricCount() is always zero upon init; Linux does implement storage.

@selissia
Copy link
Contributor Author

The statement in above comment is false, FabricCount() != 0 should indeed imply that that the device is commissioned. See this discussion: https://csamembers.slack.com/archives/G014G30SVV0/p1641823048057800

@selissia
Copy link
Contributor Author

The underlying issue is that multiple Matter devices running within a single Linux instance share the same Key Value Store ( the /tmp/chip_kvs file) . There doesn't seem to be a straightforward way of addressing this without modifying the platform layer for Linux which isn't an option this late in the release.

The workaround is to issue the following command before starting the second Matter node (chip-ota-requestor-app in this scenario):

rm /tmp/chip_kvs

@selissia
Copy link
Contributor Author

selissia commented Feb 8, 2022

This change might allow the OTA apps to be built on Linux with separate KVS files: #14832

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

No branches or pull requests

2 participants