Uploaded image for project: 'Hue (READ ONLY)'
  1. Hue (READ ONLY)
  2. HUE-2986

[desktop] Requests may error with "__str__ returned non-string (type Error" if cert validation fails

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Incomplete
    • Affects Version/s: 3.9.0
    • Fix Version/s: None
    • Component/s: core.api
    • Labels:
      None

      Description

      This specifically is the error:

      % ./build/env/bin/hue python
      >>> import requests
      >>> requests.put('https://localhost:20102/webhdfs/v1/tmp/hue_tests_1443126563.82?permission=0777&op=MKDIRS&user.name=hue&doas=hue')
      Traceback (most recent call last):
        File "<stdin>", line 1, in <module>
        File "/Users/erickt/projects/hue/hue/build/env/lib/python2.7/site-packages/requests-2.6.0-py2.7.egg/requests/api.py", line 121, in put
          return request('put', url, data=data, **kwargs)
        File "/Users/erickt/projects/hue/hue/build/env/lib/python2.7/site-packages/requests-2.6.0-py2.7.egg/requests/api.py", line 50, in request
          response = session.request(method=method, url=url, **kwargs)
        File "/Users/erickt/projects/hue/hue/build/env/lib/python2.7/site-packages/requests-2.6.0-py2.7.egg/requests/sessions.py", line 464, in request
          resp = self.send(prep, **send_kwargs)
        File "/Users/erickt/projects/hue/hue/build/env/lib/python2.7/site-packages/requests-2.6.0-py2.7.egg/requests/sessions.py", line 576, in send
          r = adapter.send(request, **kwargs)
        File "/Users/erickt/projects/hue/hue/build/env/lib/python2.7/site-packages/requests-2.6.0-py2.7.egg/requests/adapters.py", line 370, in send
          timeout=timeout
        File "/Users/erickt/projects/hue/hue/build/env/lib/python2.7/site-packages/requests-2.6.0-py2.7.egg/requests/packages/urllib3/connectionpool.py", line 544, in urlopen
          body=body, headers=headers)
        File "/Users/erickt/projects/hue/hue/build/env/lib/python2.7/site-packages/requests-2.6.0-py2.7.egg/requests/packages/urllib3/connectionpool.py", line 344, in _make_request
          self._raise_timeout(err=e, url=url, timeout_value=conn.timeout)
        File "/Users/erickt/projects/hue/hue/build/env/lib/python2.7/site-packages/requests-2.6.0-py2.7.egg/requests/packages/urllib3/connectionpool.py", line 314, in _raise_timeout
          if 'timed out' in str(err) or 'did not complete (read)' in str(err):  # Python 2.6
      TypeError: __str__ returned non-string (type Error)
      

      This is caused by this bug in urllib3, where it's not properly handling an SSL error from pyOpenSSL. When pyOpenSSL is removed, the actual error is:

      requests.exceptions.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590)
      

      This will hopefully be fixed in requests 2.8.0.

        Attachments

          Activity

            People

            • Assignee:
              erickt Erick Tryzelaar
              Reporter:
              erickt Erick Tryzelaar
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: