[Bug 2091540] Re: ssl test failures with openssl >= 3.4.0

James Page 2091540 at bugs.launchpad.net
Tue Dec 17 09:49:03 UTC 2024


I still see the same problem:

=================================== FAILURES ===================================
____________________________ SSLTest.test_ssl_close ____________________________
[gw2] linux -- Python 3.13.1 /usr/bin/python3.13

self = <tests.ssl_test.SSLTest testMethod=test_ssl_close>

    def test_ssl_close(self):
        def serve(listener):
            sock, addr = listener.accept()
            sock.recv(8192)
            try:
                self.assertEqual(b'', sock.recv(8192))
            except greenio.SSL.ZeroReturnError:
                pass
    
        sock = listen_ssl_socket()
    
        server_coro = eventlet.spawn(serve, sock)
    
        raw_client = eventlet.connect(sock.getsockname())
        client = ssl.wrap_socket(raw_client)
        client.sendall(b'X')
        greenio.shutdown_safe(client)
        client.close()
>       server_coro.wait()

tests/ssl_test.py:95: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
eventlet/greenthread.py:225: in wait
    return self._exit_event.wait()
eventlet/event.py:124: in wait
    result = hub.switch()
eventlet/hubs/hub.py:310: in switch
    return self.greenlet.switch()
eventlet/greenthread.py:265: in main
    result = function(*args, **kwargs)
tests/ssl_test.py:82: in serve
    self.assertEqual(b'', sock.recv(8192))
eventlet/green/ssl.py:255: in recv
    return self._base_recv(buflen, flags, into=False)
eventlet/green/ssl.py:282: in _base_recv
    read = self.read(nbytes)
eventlet/green/ssl.py:196: in read
    return self._call_trampolining(
eventlet/green/ssl.py:166: in _call_trampolining
    return func(*a, **kw)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <eventlet.green.ssl.GreenSSLSocket fd=18, family=2, type=1, proto=0, laddr=('127.0.0.1', 52217)>
len = 8192, buffer = None

    def read(self, len=1024, buffer=None):
        """Read up to LEN bytes and return them.
        Return zero-length string on EOF."""
    
        self._checkClosed()
        if self._sslobj is None:
            raise ValueError("Read on closed or unwrapped SSL socket.")
        try:
            if buffer is not None:
                return self._sslobj.read(len, buffer)
            else:
>               return self._sslobj.read(len)
E               ssl.SSLError: [SYS] unknown error (_ssl.c:2639)

/usr/lib/python3.13/ssl.py:1140: SSLError
----------------------------- Captured stderr call -----------------------------
Traceback (most recent call last):
  File "/<<PKGBUILDDIR>>/eventlet/hubs/poll.py", line 111, in wait
    listener.cb(fileno)
    ~~~~~~~~~~~^^^^^^^^
  File "/<<PKGBUILDDIR>>/eventlet/greenthread.py", line 265, in main
    result = function(*args, **kwargs)
  File "/<<PKGBUILDDIR>>/tests/ssl_test.py", line 82, in serve
    self.assertEqual(b'', sock.recv(8192))
                          ~~~~~~~~~^^^^^^
  File "/<<PKGBUILDDIR>>/eventlet/green/ssl.py", line 255, in recv
    return self._base_recv(buflen, flags, into=False)
           ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/<<PKGBUILDDIR>>/eventlet/green/ssl.py", line 282, in _base_recv
    read = self.read(nbytes)
  File "/<<PKGBUILDDIR>>/eventlet/green/ssl.py", line 196, in read
    return self._call_trampolining(
           ~~~~~~~~~~~~~~~~~~~~~~~^
        super().read, len, buffer)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/<<PKGBUILDDIR>>/eventlet/green/ssl.py", line 166, in _call_trampolining
    return func(*a, **kw)
  File "/usr/lib/python3.13/ssl.py", line 1140, in read
    return self._sslobj.read(len)
           ~~~~~~~~~~~~~~~~~^^^^^
ssl.SSLError: [SYS] unknown error (_ssl.c:2639)

However for now I'm going to patch the eventlet test that's failing to
deal with this.

Line 2639 is the zero return handling code - the error is not getting
translated correctly into ssl.SSLZeroReturnError - whether this is some
nuance of eventlet or a problem in Python translating the error remains
to be seen!

-- 
You received this bug notification because you are a member of Ubuntu
OpenStack, which is subscribed to python-eventlet in Ubuntu.
https://bugs.launchpad.net/bugs/2091540

Title:
  ssl test failures with openssl >= 3.4.0

Status in python-eventlet package in Ubuntu:
  New

Bug description:
  Currently blocking the build of this package in plucky-proposed - it
  looks like the behaviour between Python 3.{12,13) and openssl has
  changed a little - tests are expecting a SSLZeroReturnERror and a
  SSLError is thrown instead with "[SYS] unknown error".

  openssl 3.4.0 is currently in proposed; I've tried with older openssl
  versions and the newer pythons and the previous behaviour is observed.

  ----

  ========================================================= FAILURES =========================================================
  __________________________________________________ SSLTest.test_ssl_close __________________________________________________

  self = <tests.ssl_test.SSLTest testMethod=test_ssl_close>

      def test_ssl_close(self):
          def serve(listener):
              sock, addr = listener.accept()
              sock.recv(8192)
              try:
                  self.assertEqual(b'', sock.recv(8192))
              except greenio.SSL.ZeroReturnError:
                  pass
      
          sock = listen_ssl_socket()
      
          server_coro = eventlet.spawn(serve, sock)
      
          raw_client = eventlet.connect(sock.getsockname())
          client = ssl.wrap_socket(raw_client)
          client.sendall(b'X')
          greenio.shutdown_safe(client)
          client.close()
  >       server_coro.wait()

  tests/ssl_test.py:95: 
  _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
  eventlet/greenthread.py:225: in wait
      return self._exit_event.wait()
  eventlet/event.py:124: in wait
      result = hub.switch()
  eventlet/hubs/hub.py:310: in switch
      return self.greenlet.switch()
  eventlet/greenthread.py:265: in main
      result = function(*args, **kwargs)
  tests/ssl_test.py:82: in serve
      self.assertEqual(b'', sock.recv(8192))
  eventlet/green/ssl.py:255: in recv
      return self._base_recv(buflen, flags, into=False)
  eventlet/green/ssl.py:282: in _base_recv
      read = self.read(nbytes)
  eventlet/green/ssl.py:196: in read
      return self._call_trampolining(
  eventlet/green/ssl.py:166: in _call_trampolining
      return func(*a, **kw)
  _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

  self = <eventlet.green.ssl.GreenSSLSocket fd=14, family=2, type=1, proto=0, laddr=('127.0.0.1', 55679)>, len = 8192
  buffer = None

      def read(self, len=1024, buffer=None):
          """Read up to LEN bytes and return them.
          Return zero-length string on EOF."""
      
          self._checkClosed()
          if self._sslobj is None:
              raise ValueError("Read on closed or unwrapped SSL socket.")
          try:
              if buffer is not None:
                  return self._sslobj.read(len, buffer)
              else:
  >               return self._sslobj.read(len)
  E               ssl.SSLError: [SYS] unknown error (_ssl.c:2570)

  /usr/lib/python3.12/ssl.py:1105: SSLError
  --------------------------------------------------- Captured stderr call ---------------------------------------------------
  Traceback (most recent call last):
    File "/home/jamespage/src/upstream/eventlet/eventlet/hubs/poll.py", line 111, in wait
      listener.cb(fileno)
    File "/home/jamespage/src/upstream/eventlet/eventlet/greenthread.py", line 265, in main
      result = function(*args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/home/jamespage/src/upstream/eventlet/tests/ssl_test.py", line 82, in serve
      self.assertEqual(b'', sock.recv(8192))
                            ^^^^^^^^^^^^^^^
    File "/home/jamespage/src/upstream/eventlet/eventlet/green/ssl.py", line 255, in recv
      return self._base_recv(buflen, flags, into=False)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/home/jamespage/src/upstream/eventlet/eventlet/green/ssl.py", line 282, in _base_recv
      read = self.read(nbytes)
             ^^^^^^^^^^^^^^^^^
    File "/home/jamespage/src/upstream/eventlet/eventlet/green/ssl.py", line 196, in read
      return self._call_trampolining(
             ^^^^^^^^^^^^^^^^^^^^^^^^
    File "/home/jamespage/src/upstream/eventlet/eventlet/green/ssl.py", line 166, in _call_trampolining
      return func(*a, **kw)
             ^^^^^^^^^^^^^^
    File "/usr/lib/python3.12/ssl.py", line 1105, in read
      return self._sslobj.read(len)
             ^^^^^^^^^^^^^^^^^^^^^^
  ssl.SSLError: [SYS] unknown error (_ssl.c:2570)
  Removing descriptor: 14

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/python-eventlet/+bug/2091540/+subscriptions




More information about the Ubuntu-openstack-bugs mailing list