Uploaded image for project: 'Python Driver'
  1. Python Driver
  2. PYTHON-2921

Fix eventlet patching detection under Python 3.10

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Minor - P4 Minor - P4
    • 3.12.1, 4.0
    • Affects Version/s: None
    • Component/s: None
    • None

      We don't currently test eventlet with Python 3.10, and we shouldn't because they are incompatible:
      https://github.com/eventlet/eventlet/issues/687

      Sadly, importing eventlet has the side effect of monkey patching python:
      https://github.com/eventlet/eventlet/issues/701

      This causes problems with a utility helper in our test suite that tests if python is monkey patched by eventlet:

       [2021/09/22 22:02:24.188] ======================================================================
       [2021/09/22 22:02:24.188] ERROR [0.807s]: test_interrupt_signal (test_client.TestClient)
       [2021/09/22 22:02:24.188] ----------------------------------------------------------------------
       [2021/09/22 22:02:24.188] Traceback (most recent call last):
       [2021/09/22 22:02:24.188]   File "/data/mci/a11c848602f16b259e12b3f7342ff15f/src/test/test_client.py", line 1148, in test_interrupt_signal
       [2021/09/22 22:02:24.188]     if is_greenthread_patched():
       [2021/09/22 22:02:24.188]   File "/data/mci/a11c848602f16b259e12b3f7342ff15f/src/test/utils.py", line 926, in is_greenthread_patched
       [2021/09/22 22:02:24.188]     return gevent_monkey_patched() or eventlet_monkey_patched()
       [2021/09/22 22:02:24.188]   File "/data/mci/a11c848602f16b259e12b3f7342ff15f/src/test/utils.py", line 918, in eventlet_monkey_patched
       [2021/09/22 22:02:24.188]     import eventlet
       [2021/09/22 22:02:24.188]   File "/opt/python/3.10/lib/python3.10/site-packages/eventlet/__init__.py", line 17, in <module>
       [2021/09/22 22:02:24.188]     from eventlet import convenience
       [2021/09/22 22:02:24.188]   File "/opt/python/3.10/lib/python3.10/site-packages/eventlet/convenience.py", line 7, in <module>
       [2021/09/22 22:02:24.188]     from eventlet.green import socket
       [2021/09/22 22:02:24.188]   File "/opt/python/3.10/lib/python3.10/site-packages/eventlet/green/socket.py", line 4, in <module>
       [2021/09/22 22:02:24.188]     __import__('eventlet.green._socket_nodns')
       [2021/09/22 22:02:24.188]   File "/opt/python/3.10/lib/python3.10/site-packages/eventlet/green/_socket_nodns.py", line 11, in <module>
       [2021/09/22 22:02:24.188]     from eventlet import greenio
       [2021/09/22 22:02:24.188]   File "/opt/python/3.10/lib/python3.10/site-packages/eventlet/greenio/__init__.py", line 3, in <module>
       [2021/09/22 22:02:24.188]     from eventlet.greenio.base import *  # noqa
       [2021/09/22 22:02:24.188]   File "/opt/python/3.10/lib/python3.10/site-packages/eventlet/greenio/base.py", line 32, in <module>
       [2021/09/22 22:02:24.188]     socket_timeout = eventlet.timeout.wrap_is_timeout(socket.timeout)
       [2021/09/22 22:02:24.188]   File "/opt/python/3.10/lib/python3.10/site-packages/eventlet/timeout.py", line 166, in wrap_is_timeout
       [2021/09/22 22:02:24.188]     base.is_timeout = property(lambda _: True)
       [2021/09/22 22:02:24.188] TypeError: cannot set 'is_timeout' attribute of immutable type 'TimeoutError'
      

      The import isn't actually necessary in this helper. Removing it should work around the bad behavior from eventlet.

            Assignee:
            bernie@mongodb.com Bernie Hackett
            Reporter:
            bernie@mongodb.com Bernie Hackett
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: