-
Notifications
You must be signed in to change notification settings - Fork 935
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
monkey patch breaks gevent.sleep(0) #744
Comments
|
OK, so I basically need to sleep to something like 0.001 seconds instead of 0. |
I'm assuming that the example is very simplified from your real use-case. So yes, in that simplified example, simply sleep with a positive number. In a real program with many greenlets, |
You are correct. My use case is a pool of greenlets getting items from a queue and sending them to a remote server.
I'm using the |
Every time you At the top of the event loop, timeouts like this are checked and run, and then the operating system Not all socket operations are going to be ready at the exact same instance, and even if they are, depending on the Those are all implementation details, of course, and subject to change. My point is only that, while in principle all gevent operations are ordered, once you start mixing I/O and CPU bound operations (such as reading/writing a gevent queue, or BTW, in this example, I probably wouldn't be |
@jamadden Thanks a lot for the helpful insights! |
Cool. Can you close this then? |
'tox' has ignored the 'PYTHONDONTWRITEBYTECODE' environment option since 1.6.0 (commit 3a9c591f [1]). In the commit, an unknown issue with 'setuptools' was reported. However, this was incorrect: the issue at the time lay not with 'setuptools' but rather with 'virtualenv'. When using particular versions of 'virtualenv', the following message would be shown and the application would exit: The PYTHONDONTWRITEBYTECODE environment variable is not compatible with setuptools. Either use --distribute or unset PYTHONDONTWRITEBYTECODE. The offending message was added and later refined in virtualenv 1.7 (commits a1b8632b [2] and 32367828 [3]). However, this log was removed when support for 'setuptools' 0.7 and greater was added in 'virtualenv' 1.10 (commit cb01d9f9 [4]) There are no references to 'PYTHONDONTWRITEBYTECODE' in virtualenv 12.0 or any major release since then, suggesting the issue works as expected. Meanwhile, setuptools appears to have supported the 'PYTHONDONTWRITEBYTECODE' flag since 0.6.11 (commit 3a9c591f [5]). All in all, it appears any release of 'virtualenv' or 'setuptools' made in the past 5+ years is more than happy to work with this option and there is therefore no reason for tox to treat it any differently. Stop special casing this option and allow people to use it if they so desire. [1] tox-dev/tox@700c877 [2] pypa/virtualenv@a1b8632 [3] pypa/virtualenv@3236782 [4] pypa/virtualenv@cb01d9f [5] pypa/setuptools@3a9c591 Signed-off-by: Stephen Finucane <stephen@that.guru> Fixes: gevent#744
After monkey patching (specifically
socket
),gevent.sleep(0)
does not yield and the spawned greenlet is not executed.When setting the time of the
sleep()
to a positive number, the greenlet will start running.Reproduce:
As far as I understand,
sleep(0)
should behave the same assleep(<positive number>)
Environment:
Python 2.7.6
gevent 1.0.2
greenlet 0.4.9
The text was updated successfully, but these errors were encountered: