Skip to content

green: Fix a scheduler assertion on yielding #12818

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

Closed
wants to merge 1 commit into from

Conversation

alexcrichton
Copy link
Member

This commit fixes a small bug in the green scheduler where a scheduler task
calling maybe_yield would trip the assertion that self.yield_check_count > 0

This behavior was seen when a scheduler task was scheduled many times
successively, sending messages in a loop (via the channel send method), which
in turn invokes maybe_yield. Yielding on a sched task doesn't make sense
because as soon as it's done it will implicitly do a yield, and for this reason
the yield check is just skipped if it's a sched task.

I am unable to create a reliable test for this behavior, as there's no direct
way to have control over the scheduler tasks.

cc #12666, I discovered this when investigating that issue

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
This commit fixes a small bug in the green scheduler where a scheduler task
calling `maybe_yield` would trip the assertion that `self.yield_check_count > 0`

This behavior was seen when a scheduler task was scheduled many times
successively, sending messages in a loop (via the channel `send` method), which
in turn invokes `maybe_yield`. Yielding on a sched task doesn't make sense
because as soon as it's done it will implicitly do a yield, and for this reason
the yield check is just skipped if it's a sched task.

I am unable to create a reliable test for this behavior, as there's no direct
way to have control over the scheduler tasks.

cc rust-lang#12666, I discovered this when investigating that issue
@flaper87
Copy link
Contributor

sounds reasonable... LGTM

@alexcrichton alexcrichton deleted the small-sched-bug branch March 13, 2014 00:02
flip1995 pushed a commit to flip1995/rust that referenced this pull request May 21, 2024
doc_lazy_continuation: do not warn on End events

```
changelog: none
```

This avoids event spans that would otherwise cause crashes, since an
End's span covers the range of the tag (which will be earlier than the
line break within the tag).
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.

None yet

3 participants