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

time: positively check the deadline before reading the state of TimerEntry in Sleep #6548

Closed
wants to merge 4 commits into from

Conversation

wathenjiang
Copy link
Contributor

This is for fixing the issue #6545.

@github-actions github-actions bot added the R-loom-time-driver Run loom time driver tests on this PR label May 10, 2024
@wathenjiang
Copy link
Contributor Author

It seems the in virtualized CI environments, if the time of Sleep is too short, then we might encounter unexpected Ready.

I don't know much about the testings of metrics, and I don't know what would happen if I removed its dependency on Sleep.

However, I believe that increasing the time of Sleep can greatly solve this problem.

@Darksonn Darksonn added A-tokio Area: The main tokio crate M-time Module: tokio/time labels May 11, 2024
@Darksonn
Copy link
Contributor

Long sleeps in tests are a big problem for us because they make CI take really long. I don't want to increase them.

In general, I don't think I want to make this change. It fixes the precise case that you are referencing, yes, but it does not fix the slow task polls issue. I don't think it's worth it, and I don't want to make timers slower (see #6504).

@wathenjiang
Copy link
Contributor Author

Yes, you're right. This small patch is limited in solving slow task balls issues. Due to my belief that Sleep has provided the following guarantee: assuming the deadline is reached, then get ready from polling it. I consider that doing so may be beneficial in such similar use case.

I think increasing the time of CI is very bad, but it seems that after patching, some CIs will directly return Ready just in the first poll of Sleep. Perhaps the problem does not lie in this patch, but rather in the fact that metrics testing may not rely on Sleep.

On the other hand, it seems that we may not be able to exhaust such scenarios. For example, networks seem to have similar issues as well. For example, users may observe byte data in the read buffer of a Socket, but find that their socket read operation has not been returned.

In the end, I agree with your point of view. Telling people what blocking the thread is currently the least complex way.

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-time Module: tokio/time R-loom-time-driver Run loom time driver tests on this PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants