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

select.select with timeout=0.0 might hang #798

Open
gibizer opened this issue May 22, 2023 · 2 comments
Open

select.select with timeout=0.0 might hang #798

gibizer opened this issue May 22, 2023 · 2 comments
Labels

Comments

@gibizer
Copy link

gibizer commented May 22, 2023

In OpenStack we see that sometimes calling eventlet's select.select with timeout=0.0 hangs forever. According to the doc of python3 stdlib select.select. Timeout 0.0 means non blocking call to select.

Please see the stack of the stuck eventlet in: https://bugs.launchpad.net/neutron/+bug/2015065/comments/8 and my analysis of the call from urllib3 to eventlet in https://bugs.launchpad.net/neutron/+bug/2015065/comments/11 .

I tried to create a minimal reproducer

import eventlet

eventlet.monkey_patch()

import socket
import select

def main():
    s1 = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    s1.connect(("127.0.0.1", 8080))
    print(select.select([s1], [], [], 0.0))

if __name__ == "__main__":
    main()

But this alone does not hang.

I suspect that the CI system that showing the hang is heavily loaded. So I tried to inject sleep just before

return hub.switch()
. By that the above reproduce hangs for ever as both 0.0 timer expires in eventlet before the current eventlet reaches the hub.switch() call. However I'm not sure that injecting sleep to such eventlet code is a valid reproducer.

eventlet verison: 0.33.1
urllib3 version: 1.26.12
python version: 3.10.6-1~22.04.2ubuntu1

@itamarst
Copy link
Contributor

What is the motivation for using select() and not epoll() or poll()? select() is worse in every way, the only reason to use it is if you are on an obsolete Unix platform.

@jeckersb
Copy link

What is the motivation for using select() and not epoll() or poll()? select() is worse in every way, the only reason to use it is if you are on an obsolete Unix platform.

It's coming from urllib3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants