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

Use asyncio.wait with timeout rather than sleep #576

Merged
merged 1 commit into from Jan 4, 2022

Conversation

cottsay
Copy link
Member

@cottsay cottsay commented Dec 29, 2021

Resolves a RHEL regression caused by #571

Blocked by #575

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Linux-RHEL Build Status
  • macOS Build Status
  • Windows Build Status

@cottsay cottsay added the bug Something isn't working label Dec 29, 2021
@cottsay cottsay self-assigned this Dec 29, 2021
The latter approach seems to hang with Python 3.6.

Signed-off-by: Scott K Logan <logans@cottsay.net>
@cottsay cottsay marked this pull request as ready for review December 29, 2021 21:38
Copy link
Contributor

@sloretz sloretz left a comment

Choose a reason for hiding this comment

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

I don't understand how this would avoid a hang why the original code would hang, but the change LGTM

@clalancette
Copy link
Contributor

Unfortunately, I think this is going to bring the warning back on Jammy (Python 3.9). As far as I can tell, you can no longer pass a future directly to asyncio.wait, and you now have to wrap all futures in async tasks (see https://stackoverflow.com/questions/66029772/alternative-to-asyncio-wait and https://bugs.python.org/issue34790).

Why that causes a hang in RHEL, I'm not sure. I guess we could do conditional code based on the version of Python that is in use?

@cottsay
Copy link
Member Author

cottsay commented Dec 31, 2021

Unfortunately, I think this is going to bring the warning back on Jammy (Python 3.9)

I don't see how. #571 wrapped the asyncio.sleep coroutine in a task, and this change removes that sleep altogether in favor of the timeout argument to wait.

Why that causes a hang in RHEL, I'm not sure.

I really don't know either, but I didn't do very much investigation. Once I realized that the code could be simplified and found that it solved the hang, I moved on.

Copy link
Contributor

@hidmic hidmic left a comment

Choose a reason for hiding this comment

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

LGTM, though I don't understand why the hang in RHEL either.

Copy link
Contributor

@clalancette clalancette left a comment

Choose a reason for hiding this comment

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

Never mind, on Jammy this seems to work fine. So 👍 from me.

@cottsay cottsay merged commit 32dbb67 into master Jan 4, 2022
@delete-merged-branch delete-merged-branch bot deleted the cottsay/with-with-timeout branch January 4, 2022 19:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants