Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Notify receivers in mpsc channel OwnedPermit::release() method#8075

Merged
Darksonn merged 2 commits into
tokio-rs:tokio-1.47.xfrom
Darksonn:alice/release-owned-permit
May 7, 2026
Merged

Notify receivers in mpsc channel OwnedPermit::release() method#8075
Darksonn merged 2 commits into
tokio-rs:tokio-1.47.xfrom
Darksonn:alice/release-owned-permit

Conversation

@Darksonn
Copy link
Copy Markdown
Member

The OwnedPermit::release() method is missing a check for whether the receiver should be woken up. This results in lost wakeups when combined with Receiver::close().

This bug was discovered by asking Gemini to look for bugs in the release method of tokio/src/sync/mpsc/bounded.rs.

@Darksonn Darksonn added A-tokio Area: The main tokio crate M-sync Module: tokio/sync labels Apr 20, 2026
@github-actions github-actions Bot added the R-loom-sync Run loom sync tests on this PR label Apr 20, 2026
@Darksonn
Copy link
Copy Markdown
Member Author

This probably requires a backport, so it should not be merged until base branch is updated.

Comment thread tokio/tests/sync_mpsc.rs
@Darksonn Darksonn force-pushed the alice/release-owned-permit branch from d1db1a9 to 855f2f1 Compare May 2, 2026 16:53
@Darksonn Darksonn changed the base branch from master to tokio-1.47.x May 2, 2026 16:53
@Darksonn Darksonn merged commit f085b62 into tokio-rs:tokio-1.47.x May 7, 2026
90 checks passed
@Darksonn Darksonn deleted the alice/release-owned-permit branch May 7, 2026 07:32
eleboucher pushed a commit to eleboucher/towonel that referenced this pull request May 9, 2026
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [tokio](https://tokio.rs) ([source](https://github.com/tokio-rs/tokio)) | workspace.dependencies | patch | `1.52.2` → `1.52.3` |

---

### Release Notes

<details>
<summary>tokio-rs/tokio (tokio)</summary>

### [`v1.52.3`](https://github.com/tokio-rs/tokio/releases/tag/tokio-1.52.3): Tokio v1.52.3

[Compare Source](tokio-rs/tokio@tokio-1.52.2...tokio-1.52.3)

### 1.52.3 (May 8th, 2026)

##### Fixed

- sync: fix underflow in mpsc channel `len()` ([#&#8203;8062])
- sync: notify receivers in mpsc `OwnedPermit::release()` method ([#&#8203;8075])
- sync: require that an `RwLock` has `max_readers != 0` ([#&#8203;8076])
- sync: return `Empty` from `try_recv()` when mpsc is closed with outstanding permits ([#&#8203;8074])

[#&#8203;8062]: tokio-rs/tokio#8062

[#&#8203;8074]: tokio-rs/tokio#8074

[#&#8203;8075]: tokio-rs/tokio#8075

[#&#8203;8076]: tokio-rs/tokio#8076

</details>

---

### Configuration

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

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

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

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4xMDEuMSIsInVwZGF0ZWRJblZlciI6IjQzLjEwMS4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJ0eXBlL3BhdGNoIl19-->

Reviewed-on: https://git.erwanleboucher.dev/eleboucher/towonel/pulls/36
eleboucher pushed a commit to eleboucher/towonel that referenced this pull request May 20, 2026
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [tokio](https://tokio.rs) ([source](https://github.com/tokio-rs/tokio)) | workspace.dependencies | patch | `1.52.2` → `1.52.3` |

---

### Release Notes

<details>
<summary>tokio-rs/tokio (tokio)</summary>

### [`v1.52.3`](https://github.com/tokio-rs/tokio/releases/tag/tokio-1.52.3): Tokio v1.52.3

[Compare Source](tokio-rs/tokio@tokio-1.52.2...tokio-1.52.3)

### 1.52.3 (May 8th, 2026)

##### Fixed

- sync: fix underflow in mpsc channel `len()` ([#&#8203;8062])
- sync: notify receivers in mpsc `OwnedPermit::release()` method ([#&#8203;8075])
- sync: require that an `RwLock` has `max_readers != 0` ([#&#8203;8076])
- sync: return `Empty` from `try_recv()` when mpsc is closed with outstanding permits ([#&#8203;8074])

[#&#8203;8062]: tokio-rs/tokio#8062

[#&#8203;8074]: tokio-rs/tokio#8074

[#&#8203;8075]: tokio-rs/tokio#8075

[#&#8203;8076]: tokio-rs/tokio#8076

</details>

---

### Configuration

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

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

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

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4xMDEuMSIsInVwZGF0ZWRJblZlciI6IjQzLjEwMS4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJ0eXBlL3BhdGNoIl19-->

Reviewed-on: https://git.erwanleboucher.dev/eleboucher/towonel/pulls/36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-tokio Area: The main tokio crate M-sync Module: tokio/sync R-loom-sync Run loom sync tests on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants