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

Python 3.13: AttributeError: module 'eventlet.green.thread' has no attribute 'start_joinable_thread' #964

Closed
musicinmybrain opened this issue Jun 5, 2024 · 3 comments · May be fixed by #966

Comments

@musicinmybrain
Copy link

On Python 3.13, there are several errors in test collection due to AttributeError: module 'eventlet.green.thread' has no attribute 'start_joinable_thread'.

To reproduce:

$ gh repo clone eventlet/eventlet
$ python3.13 -V
Python 3.13.0b1
$ tox -e py313
[…]
Failed to build greenlet

So we need to build a version of greenlet that supports Python 3.13, using python-greenlet/greenlet#396:

$ . .tox/py313/bin/activate
(py313) $ cd ..
(py313) $ gh repo clone python-greenlet/greenlet
(py313) $ git remote add vstinner https://github.com/vstinner/greenlet.git
(py313) $ git fetch --all
(py313) $ git checkout py313
(py313) $ pip install -e .
(py313) $ cd ../eventlet
(py313) $ deactivate

Now we can try again:

$ tox -e py313
==================================================================================================== ERRORS ====================================================================================================
____________________________________________________________________________________ ERROR collecting tests/asyncio_test.py ____________________________________________________________________________________
tests/asyncio_test.py:18: in <module>
    from .wsgi_test import _TestBase, Site
<frozen importlib._bootstrap>:1360: in _find_and_load
    ???
<frozen importlib._bootstrap>:1331: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:935: in _load_unlocked
    ???
.tox/py313/lib/python3.13/site-packages/_pytest/assertion/rewrite.py:178: in exec_module
    exec(co, module.__dict__)
tests/wsgi_test.py:21: in <module>
    from eventlet import wsgi
eventlet/wsgi.py:14: in <module>
    from eventlet.green import BaseHTTPServer
eventlet/green/BaseHTTPServer.py:3: in <module>
    from eventlet.green import SocketServer
eventlet/green/SocketServer.py:5: in <module>
    from eventlet.green import threading
eventlet/green/threading.py:18: in <module>
    eventlet.patcher.inject(
eventlet/patcher.py:109: in inject
    module = __import__(module_name, {}, {}, module_name.split('.')[:-1])
/usr/lib64/python3.13/threading.py:35: in <module>
    _start_joinable_thread = _thread.start_joinable_thread
E   AttributeError: module 'eventlet.green.thread' has no attribute 'start_joinable_thread'
__________________________________________________________________________________ ERROR collecting tests/subprocess_test.py ___________________________________________________________________________________
tests/subprocess_test.py:5: in <module>
    from eventlet.green import subprocess
eventlet/green/subprocess.py:8: in <module>
    from eventlet.green import select, threading, time
eventlet/green/threading.py:18: in <module>
    eventlet.patcher.inject(
eventlet/patcher.py:109: in inject  
    module = __import__(module_name, {}, {}, module_name.split('.')[:-1])
/usr/lib64/python3.13/threading.py:35: in <module>
    _start_joinable_thread = _thread.start_joinable_thread
E   AttributeError: module 'eventlet.green.thread' has no attribute 'start_joinable_thread'
__________________________________________________________________________________ ERROR collecting tests/test__greenness.py ___________________________________________________________________________________
tests/test__greenness.py:6: in <module>
    from eventlet.green import BaseHTTPServer
eventlet/green/BaseHTTPServer.py:3: in <module>
    from eventlet.green import SocketServer
eventlet/green/SocketServer.py:5: in <module>
    from eventlet.green import threading
eventlet/green/threading.py:18: in <module>
    eventlet.patcher.inject(
eventlet/patcher.py:109: in inject  
    module = __import__(module_name, {}, {}, module_name.split('.')[:-1])
/usr/lib64/python3.13/threading.py:35: in <module>
    _start_joinable_thread = _thread.start_joinable_thread
E   AttributeError: module 'eventlet.green.thread' has no attribute 'start_joinable_thread'
_________________________________________________________________________________ ERROR collecting tests/websocket_new_test.py _________________________________________________________________________________
tests/websocket_new_test.py:7: in <module>
    from eventlet import websocket  
eventlet/websocket.py:21: in <module>
    from eventlet import wsgi
eventlet/wsgi.py:14: in <module>
    from eventlet.green import BaseHTTPServer
eventlet/green/BaseHTTPServer.py:3: in <module>
    from eventlet.green import SocketServer
eventlet/green/SocketServer.py:5: in <module>
    from eventlet.green import threading
eventlet/green/threading.py:18: in <module>
    eventlet.patcher.inject(
eventlet/patcher.py:109: in inject  
    module = __import__(module_name, {}, {}, module_name.split('.')[:-1])
/usr/lib64/python3.13/threading.py:35: in <module>
    _start_joinable_thread = _thread.start_joinable_thread
E   AttributeError: module 'eventlet.green.thread' has no attribute 'start_joinable_thread'
___________________________________________________________________________________ ERROR collecting tests/websocket_test.py ___________________________________________________________________________________
tests/websocket_test.py:9: in <module>
    from eventlet.websocket import WebSocket, WebSocketWSGI
eventlet/websocket.py:21: in <module>
    from eventlet import wsgi
eventlet/wsgi.py:14: in <module>
    from eventlet.green import BaseHTTPServer
eventlet/green/BaseHTTPServer.py:3: in <module>
    from eventlet.green import SocketServer
eventlet/green/SocketServer.py:5: in <module>
    from eventlet.green import threading
eventlet/green/threading.py:18: in <module>
    eventlet.patcher.inject(
eventlet/patcher.py:109: in inject  
    module = __import__(module_name, {}, {}, module_name.split('.')[:-1])
/usr/lib64/python3.13/threading.py:35: in <module>
    _start_joinable_thread = _thread.start_joinable_thread
E   AttributeError: module 'eventlet.green.thread' has no attribute 'start_joinable_thread'
_____________________________________________________________________________________ ERROR collecting tests/wsgi_test.py ______________________________________________________________________________________
tests/wsgi_test.py:21: in <module>  
    from eventlet import wsgi
eventlet/wsgi.py:14: in <module>
    from eventlet.green import BaseHTTPServer
eventlet/green/BaseHTTPServer.py:3: in <module>
    from eventlet.green import SocketServer
eventlet/green/SocketServer.py:5: in <module>
    from eventlet.green import threading
eventlet/green/threading.py:18: in <module>
    eventlet.patcher.inject(
eventlet/patcher.py:109: in inject  
    module = __import__(module_name, {}, {}, module_name.split('.')[:-1])
/usr/lib64/python3.13/threading.py:35: in <module>
    _start_joinable_thread = _thread.start_joinable_thread
E   AttributeError: module 'eventlet.green.thread' has no attribute 'start_joinable_thread'

----------- coverage: platform linux, python 3.13.0-beta-1 -----------
Name                                              Stmts   Miss Branch BrPart  Cover
-----------------------------------------------------------------------------------
[… coverage lines omitted …]
-----------------------------------------------------------------------------------
TOTAL                                              9778   8197   3538     43    13%

=========================================================================================== short test summary info ============================================================================================
ERROR tests/asyncio_test.py - AttributeError: module 'eventlet.green.thread' has no attribute 'start_joinable_thread'
ERROR tests/subprocess_test.py - AttributeError: module 'eventlet.green.thread' has no attribute 'start_joinable_thread'
ERROR tests/test__greenness.py - AttributeError: module 'eventlet.green.thread' has no attribute 'start_joinable_thread'
ERROR tests/websocket_new_test.py - AttributeError: module 'eventlet.green.thread' has no attribute 'start_joinable_thread'
ERROR tests/websocket_test.py - AttributeError: module 'eventlet.green.thread' has no attribute 'start_joinable_thread'
ERROR tests/wsgi_test.py - AttributeError: module 'eventlet.green.thread' has no attribute 'start_joinable_thread'
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 6 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
============================================================================================== 6 errors in 2.73s ===============================================================================================
py313: exit 2 (3.24 seconds) /home/ben/src/forks/eventlet> pytest --verbose --cov=eventlet tests/ pid=300264
  py313: FAIL code 2 (6.88=setup[0.13]+cmd[3.51,3.24] seconds)
  evaluation failed :( (6.94 seconds)
@hroncok
Copy link
Contributor

hroncok commented Jun 6, 2024

@hroncok
Copy link
Contributor

hroncok commented Jun 6, 2024

There are more attributes, but adding them all seem to work. Will open a PR if all tests pass.

hroncok added a commit to hroncok/eventlet that referenced this issue Jun 6, 2024
@hroncok
Copy link
Contributor

hroncok commented Jun 6, 2024

#965 does that but it still doesn't work -- hopefully it will help debug the thing.

stefanor added a commit to stefanor/eventlet that referenced this issue Nov 7, 2024
Emulate Python 3.13's start_joinable_thread API using greenthreads

Fixes: eventlet#964
stefanor added a commit to stefanor/eventlet that referenced this issue Nov 7, 2024
Emulate Python 3.13's start_joinable_thread API using greenthreads.

We cut some corners, of course:
* We aren't maintaining a table of green thread idents to threads, so we
  can't wait for all threads on shutdown.
* Our _make_thread_handle() can only make a handle for the current
  thread (as we don't have a way to look up green threads by ident).
* .join() on a non-GreenThread (e.g. the main thread) just returns
  immediately.

Fixes: eventlet#964
bmwiedemann pushed a commit to bmwiedemann/openSUSE that referenced this issue Nov 8, 2024
… 57 via SR 1218077

https://build.opensuse.org/request/show/1218077
by user mcepl + anag+factory
- Temporarily switch to direct download from GitHub, and update
  to version 0.37.0+git.1726056572.8637820:
  * Update changelog for version 0.37.0 (#980)
  * Describes Eventlet's Alternatives Into the Migration Guide (#971)
  * fix migration guide url (#978)
  * os.read/write waits until file descriptor is ready. (#975)
  * Upgrade RLocks as last thing we do (#970)
  * warns about using multiple readers (#960)
  * drop header keys with underscores (#959)
  * doc: Repair changelog link (#958)
  * Make the docs more user friendly (#950)
  * Update changelog for version 0.36.1 (#952)
- Add patches making it build with 3.13:
  - 313-new-thread-attributes.patch (gh#eventlet/eventlet#964)
  - no-dynamic-version.patch (we cannot use dynamic version
    number on a git checkout)
- Fix setting of t
stefanor added a commit to stefanor/eventlet that referenced this issue Nov 13, 2024
Emulate Python 3.13's start_joinable_thread API using greenthreads.

We cut some corners, of course:
* We aren't maintaining a table of green thread idents to threads, so we
  can't wait for all threads on shutdown.
* Our _make_thread_handle() can only make a handle for the current
  thread (as we don't have a way to look up green threads by ident).
* .join() on a non-GreenThread (e.g. the main thread) just returns
  immediately.

Fixes: eventlet#964
@4383 4383 closed this as completed in 4d48d10 Nov 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants