Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-5595

TSocket errors with SSLSocket

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 0.14.0, 0.15.0, 0.16.0
    • 0.17.0
    • Python - Library
    • None

    Description

      Starting with 0.14.0 - probably this commit - when we call isOpen on an open TSSLSocket we get an error:

        File "/home/michael/Impala/shell/build/py2_venv/local/lib/python2.7/site-packages/impala_shell/impala_client.py", line 226, in _close_transport
          if self.transport and self.transport.isOpen():
        File "/home/michael/Impala/shell/build/py2_venv/local/lib/python2.7/site-packages/impala_shell/thrift/transport/TTransport.py", line 150, in isOpen
          return self.__trans.isOpen()
        File "/home/michael/Impala/shell/build/py2_venv/local/lib/python2.7/site-packages/thrift/transport/TSocket.py", line 92, in isOpen
          peeked_bytes = self.handle.recv(1, socket.MSG_PEEK)
        File "/usr/lib/python2.7/ssl.py", line 753, in recv
          self.__class__)
      ValueError: non-zero flags not allowed in calls to recv() on <class 'ssl.SSLSocket'>
      

      A relatively simple reproduction (if you have an open socket to connect to) is

      from thrift.transport import TSSLSocket
      import ssl
      sock = TSSLSocket.TSSLSocket('localhost', '21000', ssl.CERT_NONE, None, None, ssl_version=ssl.PROTOCOL_SSLv23)
      sock.open()
      sock.isOpen()
      

      which produces

      Traceback (most recent call last):
        File "<stdin>", line 1, in <module>
        File "/home/michael/Impala/shell/build/py3_venv/lib/python3.8/site-packages/thrift/transport/TSocket.py", line 92, in isOpen
          peeked_bytes = self.handle.recv(1, socket.MSG_PEEK)
        File "/usr/lib/python3.8/ssl.py", line 1223, in recv
          raise ValueError(
      ValueError: non-zero flags not allowed in calls to recv() on <class 'ssl.SSLSocket'>
      

      I've reproduced this with python 2.7 and python 3.8.

      Attachments

        Issue Links

          Activity

            People

              MikaelSmith Michael Smith
              MikaelSmith Michael Smith
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 1h 10m
                  1h 10m