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

ConsentList Concurrency Crash #315

Merged
merged 3 commits into from
Apr 17, 2024
Merged

ConsentList Concurrency Crash #315

merged 3 commits into from
Apr 17, 2024

Conversation

nplasterer
Copy link
Contributor

Fixes #314

Lets make the entries list a actor so that we don't accidentally try to modify the map at the same time. Likely causing this crash.

@nplasterer nplasterer self-assigned this Apr 17, 2024
@nplasterer nplasterer requested a review from a team as a code owner April 17, 2024 19:04

try await withThrowingTaskGroup(of: ConsentListEntry.self) { group in
for address in addresses {
group.addTask {
Copy link
Contributor

Choose a reason for hiding this comment

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

I gather that you want this to be serial as opposed to parallel.

As I read this, it looks like the inner for loop here will be executed in parallel. I think that the return await inside might cover it, but I'm suspicious.

If that's ok for this part of the operation, then you're good. The outer loop executions look to be serial. I would back it with a test to verify the order though. Stepping between serial & parallel executions can get a bit tricky and produce unexpected results.

@nplasterer nplasterer merged commit 321c449 into main Apr 17, 2024
2 checks passed
@nplasterer nplasterer deleted the np/ios-concurrency-crash branch April 17, 2024 21:29
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

Successfully merging this pull request may close these issues.

Bug: fairly reproducible crasher in ConsentList - concurrency data access race on property storage
3 participants