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 potential deadlock in Shared #3356

Merged
merged 6 commits into from
Sep 6, 2024
Merged

Fix potential deadlock in Shared #3356

merged 6 commits into from
Sep 6, 2024

Conversation

mbrandonw
Copy link
Member

@mbrandonw mbrandonw commented Sep 5, 2024

Fixes #3355.

@zachwaugh
Copy link

Thanks @mbrandonw! Good news is I confirmed it fixes #3355 for me. Unfortunately it doesn't fix #3311. In that case, it's already on the main thread, so it skips the DispatchQueue.main.async branch already:

Screenshot 2024-09-05 at 7 47 31 PM

I'll spend some more time trying to make a repro for that one now that I have the other working, hopefully can modify it a bit to trigger that.

@mbrandonw
Copy link
Member Author

I'll spend some more time trying to make a repro for that one now that I have the other working, hopefully can modify it a bit to trigger that.

Hi @zachwaugh, thanks for confirming #3355, and good to know about #3311. That is a bummer. We could of course go full main.async, but it is nice to maintain some synchronicity in the subscription where possible. If you come up with a repo that would be very helpful.

@mbrandonw mbrandonw merged commit 2c8b1c0 into main Sep 6, 2024
6 checks passed
@mbrandonw mbrandonw deleted the fix-shared-deadlock branch September 6, 2024 16:11
mergify bot added a commit to cgrindel/rules_swift_package_manager that referenced this pull request Sep 16, 2024
…ure to from: "1.15.0" (#1230)

This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
|
[pointfreeco/swift-composable-architecture](https://redirect.github.com/pointfreeco/swift-composable-architecture)
| minor | `from: "1.13.1"` -> `from: "1.15.0"` |

---

### Release Notes

<details>
<summary>pointfreeco/swift-composable-architecture
(pointfreeco/swift-composable-architecture)</summary>

###
[`v1.15.0`](https://redirect.github.com/pointfreeco/swift-composable-architecture/releases/tag/1.15.0)

[Compare
Source](https://redirect.github.com/pointfreeco/swift-composable-architecture/compare/1.14.0...1.15.0)

#### What's Changed

- Added: Complete Swift 6 Language Mode support
([pointfreeco/swift-composable-architecture#3282,
[pointfreeco/swift-composable-architecture#3318;
[pointfreeco/swift-composable-architecture#3317;
[pointfreeco/swift-composable-architecture#3321;
[pointfreeco/swift-composable-architecture#3325;
[pointfreeco/swift-composable-architecture#3326;
[pointfreeco/swift-composable-architecture#3320;
[pointfreeco/swift-composable-architecture#3333;
[pointfreeco/swift-composable-architecture#3329).
- Fixed: Warn when bindable store is sent a binding action without
having integrated with `BindingReducer`
([pointfreeco/swift-composable-architecture#3347).
- Fixed: Remove and lock subscriptions from the Combine subject powering
Store and Shared subscriptions (thanks
[@&#8203;iampatbrown](https://redirect.github.com/iampatbrown),
[pointfreeco/swift-composable-architecture#2699).
This should improve memory and avoid potential issues related to
concurrent access to the publisher.
- Fixed: Avoid potential deadlock in `Shared` by dispatching to the main
actor
([pointfreeco/swift-composable-architecture#3356).
- Fixed: Swift Testing support for concurrent tests by bucketing
cancellation identifiers to each `@Test`
([pointfreeco/swift-composable-architecture#3374).
- Infrastructure: Remove disfavored `NSObject.observe` overload in favor
of SwiftNavigation's `observe`
([pointfreeco/swift-composable-architecture#3316)
- Infrastructure: Fix typo and deprecated content in `Performance.md`
(thanks [@&#8203;MaraMincho](https://redirect.github.com/MaraMincho),
[pointfreeco/swift-composable-architecture#3323);
'WhatIsNavigation.md' fixes (thanks
[@&#8203;stealmh](https://redirect.github.com/stealmh),
[pointfreeco/swift-composable-architecture#3345);
fix typos (thanks
[@&#8203;stealmh](https://redirect.github.com/stealmh),
[pointfreeco/swift-composable-architecture#3349;
thanks [@&#8203;O-O-wl](https://redirect.github.com/O-O-wl),
[pointfreeco/swift-composable-architecture#3354);
replace deprecated `viewStore` with `store` in documentation (thanks
[@&#8203;qwerty3345](https://redirect.github.com/qwerty3345),
[pointfreeco/swift-composable-architecture#3341).
- Infrastructure: Added failing test to document behavior with
observation/identified array
([pointfreeco/swift-composable-architecture#3346).
- Infrastructure: Update `05-HigherOrderReducers` CaseStudies (thanks
[@&#8203;qwerty3345](https://redirect.github.com/qwerty3345),
[pointfreeco/swift-composable-architecture#3342);
update `04-Navigation-Lists-NavigateAndLoad` CaseStudies (thanks
[@&#8203;MaraMincho](https://redirect.github.com/MaraMincho),
[pointfreeco/swift-composable-architecture#3327).
- Infrastructure: Issue template updates
([pointfreeco/swift-composable-architecture#3363).
- Infrastructure: Apply `any` to all existential protocol uses (thanks
[@&#8203;qwerty3345](https://redirect.github.com/qwerty3345),
[pointfreeco/swift-composable-architecture#3370).
- Infrastructure: Improve CI job performance
([pointfreeco/swift-composable-architecture#3357).
- Infrastructure: Remove outdated `#if` branching in the library
([pointfreeco/swift-composable-architecture#3376).

#### New Contributors

- [@&#8203;stealmh](https://redirect.github.com/stealmh) made their
first contribution in
[pointfreeco/swift-composable-architecture#3345
- [@&#8203;O-O-wl](https://redirect.github.com/O-O-wl) made their first
contribution in
[pointfreeco/swift-composable-architecture#3354

**Full Changelog**:
pointfreeco/swift-composable-architecture@1.14.0...1.15.0

###
[`v1.14.0`](https://redirect.github.com/pointfreeco/swift-composable-architecture/releases/tag/1.14.0)

[Compare
Source](https://redirect.github.com/pointfreeco/swift-composable-architecture/compare/1.13.1...1.14.0)

#### What's Changed

- Added: Isolate `Store`, `TestStore`, and various view helpers to the
`@MainActor`
([pointfreeco/swift-composable-architecture#3277,
[pointfreeco/swift-composable-architecture#3283).
This has been done with `@preconcurrency` for backwards compatibility.
If you are using strict concurrency it may require you add `@MainActor`
annotations to any SwiftUI view helpers that access the store.
- Fixed: Don't eagerly dismiss an alert presented by another
([pointfreeco/swift-composable-architecture#3309).
- Infrastructure: Bump Swift Navigation version
([pointfreeco/swift-composable-architecture#3310).
- Infrastructure: Documentation fixes (thanks
[@&#8203;woohyunjin06](https://redirect.github.com/woohyunjin06),
[pointfreeco/swift-composable-architecture#3296;
[@&#8203;MaraMincho](https://redirect.github.com/MaraMincho),
[pointfreeco/swift-composable-architecture#3299).

#### New Contributors

- [@&#8203;woohyunjin06](https://redirect.github.com/woohyunjin06) made
their first contribution in
[pointfreeco/swift-composable-architecture#3296
- [@&#8203;MaraMincho](https://redirect.github.com/MaraMincho) made
their first contribution in
[pointfreeco/swift-composable-architecture#3299
- [@&#8203;qwerty3345](https://redirect.github.com/qwerty3345) made
their first contribution in
[pointfreeco/swift-composable-architecture#3305

**Full Changelog**:
pointfreeco/swift-composable-architecture@1.13.1...1.14.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the
rebase/retry checkbox.

👻 **Immortal**: This PR will be recreated if closed unmerged. Get
[config
help](https://redirect.github.com/renovatebot/renovate/discussions) if
that's undesired.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Renovate
Bot](https://redirect.github.com/renovatebot/renovate).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOC44MC4wIiwidXBkYXRlZEluVmVyIjoiMzguODAuMCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==-->

Co-authored-by: cgrindel-self-hosted-renovate[bot] <139595543+cgrindel-self-hosted-renovate[bot]@users.noreply.github.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
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.

Deadlock on main thread when loading dependencies and @Shared values
3 participants