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

Fix data races in chip-tool on Darwin #7829

Merged
merged 4 commits into from
Jun 23, 2021

Conversation

bzbarsky-apple
Copy link
Contributor

Problem

We have some remaining data races in chip-tool on Darwin.

Change overview

Queue the initial command Run method over to the CHIP thread so that all the work apart from initial setup and final teardown of the CHIP stack happens on that thread, avoiding races.

Testing

Ran #7797 without this change (fails every time) and with this change (passes every time on Darwin).

Note that this change makes #7797 fail on Linux until #7828 is fixed.

Reviewer note: There are 4 changesets here; reviewing them separately is probably a lot easier than reviewing the whole thing all at once.

@bzbarsky-apple
Copy link
Contributor Author

@Damian-Nordic @jmartinez-silabs @andy31415 @mspang please take a look. Note that it's easier to review the individual changesets here than the whole thing at once.

@@ -36,6 +36,7 @@ class DiscoverCommand : public Command, public chip::Controller::DeviceAddressUp

/////////// Command Interface /////////
CHIP_ERROR Run() override;
uint16_t GetWaitDurationInSeconds() const override { return 30; }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, Just wondering about the different GetWaitDurationInSeconds values here and in following command interfaces. How were they determined?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bzbarsky-apple can you follow up here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I kept the existing values, which I suspect were determined by "this should not take longer than, oh I guess this long" or so.

@woody-apple woody-apple merged commit 5ccb591 into project-chip:master Jun 23, 2021
@bzbarsky-apple bzbarsky-apple deleted the fix-chip-tool-races branch June 23, 2021 13:11
sharadb-amazon added a commit to sharadb-amazon/connectedhomeip that referenced this pull request Jun 23, 2021
nikita-s-wrk pushed a commit to nikita-s-wrk/connectedhomeip that referenced this pull request Sep 23, 2021
* Move the local and remote node ids into the exec context for chip-tool commands.

This makes Run() not take any arguments, which makes it easier to
queue parts of it to run async.

* Switch SetCommandExitStatus to take a CHIP_ERROR argument

* Regenerate generated code for SetCommandExitStatus changes

* Change chip-tool to generally touch the stack only from a queued task.

Except init and shutdown.
dmitrymaslovdsr added a commit to dmitrymaslovdsr/connectedhomeip that referenced this pull request Apr 16, 2024
…idaiton; remove TimeReference, PeakPeriodStatus, PeakPeriodEndTime attributes validation based on PR project-chip#7829

Signed-off-by: Dmitry Maslov <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants