Skip to content

Updating from version 1.1.6 to 2.0.0 results in TypeError: _wrap_socket() argument 'sock' must be _socket.socket, not SSLSocket #557

@jamesbraza

Description

@jamesbraza

Hello DNS Python,

I am "modernizing" the packages in a repo's requirements.txt. The repo's code is ultimately used on a Windows 10 machine with Python 3.8.2. It has a few 3rd party packages relevant to this issue:

  • eventlet==0.25.2
  • signalfx==1.1.9 (package used to ingest time series data into SignalFx)
  • dnspython's version was not pinned in my requirements.txt

It seems about two weeks ago, version 2.0.0 of dnspython was released. Thus, now the current newest version is used.

Unfortunately, I found SignalFx ingestion no longer works, throwing an error on post with the below stack trace:

2020-07-27 16:00:09,408:ERROR:signalfx.ingest:Posting data to SignalFx failed.
Traceback (most recent call last):
  File "C:\path\to\venv\lib\site-packages\signalfx\ingest.py", line 245, in _send
    self._post(self._batch_data(datapoints_list),
  File "C:\path\to\venv\lib\site-packages\signalfx\ingest.py", line 275, in _post
    response = session.post(url, data=data, timeout=timeout)
  File "C:\path\to\venv\lib\site-packages\requests\sessions.py", line 578, in post
    return self.request('POST', url, data=data, json=json, **kwargs)
  File "C:\path\to\venv\lib\site-packages\requests\sessions.py", line 530, in request
    resp = self.send(prep, **send_kwargs)
  File "C:\path\to\venv\lib\site-packages\requests\sessions.py", line 643, in send
    r = adapter.send(request, **kwargs)
  File "C:\path\to\venv\lib\site-packages\requests\adapters.py", line 439, in send
    resp = conn.urlopen(
  File "C:\path\to\venv\lib\site-packages\urllib3\connectionpool.py", line 670, in urlopen
    httplib_response = self._make_request(
  File "C:\path\to\venv\lib\site-packages\urllib3\connectionpool.py", line 381, in _make_request
    self._validate_conn(conn)
  File "C:\path\to\venv\lib\site-packages\urllib3\connectionpool.py", line 978, in _validate_conn
    conn.connect()
  File "C:\path\to\venv\lib\site-packages\urllib3\connection.py", line 362, in connect
    self.sock = ssl_wrap_socket(
  File "C:\path\to\venv\lib\site-packages\urllib3\util\ssl_.py", line 384, in ssl_wrap_socket
    return context.wrap_socket(sock, server_hostname=server_hostname)
  File "C:\Python38\lib\ssl.py", line 500, in wrap_socket
    return self.sslsocket_class._create(
  File "C:\Python38\lib\ssl.py", line 1031, in _create
    self._sslobj = self._context._wrap_socket(
TypeError: _wrap_socket() argument 'sock' must be _socket.socket, not SSLSocket

Initially, I made an issue in signalfx-python, but came to realize via lots of trial and error, that the root cause was usage of the newest version of dnspython.

By pinning dnspython==1.16.0, ingestion of data into SignalFx now works again. I am making this issue to get stuff fixed up "for the next guy", as root causing this problem was time consuming.

Any ideas as to what has changed that might have created this issue?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions