Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handshake error with urllib #245

Open
ViRaL95 opened this issue Jan 8, 2020 · 2 comments
Open

Handshake error with urllib #245

ViRaL95 opened this issue Jan 8, 2020 · 2 comments

Comments

@ViRaL95
Copy link

ViRaL95 commented Jan 8, 2020

Here is my code:

    for account, queued_jobs in self.accounts_to_queued_jobs.items():
        for queued_job in queued_jobs:
            async_stats_job_result = self.entity_type.async_stats_job_result(account,
                                                                             queued_job.id)
            status = next(async_stats_job_result).status
            while status == 'PROCESSING':
                async_stats_job_result = self.entity_type.async_stats_job_result(account,
                                                                                 queued_job.id)
                status = next(async_stats_job_result).status
                time.sleep(5)

I am getting the following error:

Traceback (most recent call last):
  File "/home/ubuntu/.local/lib/python3.6/site-packages/urllib3/contrib/pyopenssl.py", line 485, in wrap_socket
    cnx.do_handshake()
  File "/usr/lib/python3/dist-packages/OpenSSL/SSL.py", line 1808, in do_handshake
    self._raise_ssl_error(self._ssl, result)
  File "/usr/lib/python3/dist-packages/OpenSSL/SSL.py", line 1541, in _raise_ssl_error
    raise SysCallError(-1, "Unexpected EOF")
OpenSSL.SSL.SysCallError: (-1, 'Unexpected EOF')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/ubuntu/.local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 672, in urlopen
    chunked=chunked,
  File "/home/ubuntu/.local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 376, in _make_request
    self._validate_conn(conn)
  File "/home/ubuntu/.local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 994, in _validate_conn
    conn.connect()
  File "/home/ubuntu/.local/lib/python3.6/site-packages/urllib3/connection.py", line 394, in connect
    ssl_context=context,
  File "/home/ubuntu/.local/lib/python3.6/site-packages/urllib3/util/ssl_.py", line 370, in ssl_wrap_socket
    return context.wrap_socket(sock, server_hostname=server_hostname)
  File "/home/ubuntu/.local/lib/python3.6/site-packages/urllib3/contrib/pyopenssl.py", line 491, in wrap_socket
    raise ssl.SSLError("bad handshake: %r" % e)
ssl.SSLError: ("bad handshake: SysCallError(-1, 'Unexpected EOF')",)

The stacktrace doesnt point to an error within my code but points to urllib3. Is this an issue with twitter-python-ads-sdk integrating with urllib3? I was not able to reproduce the issue

@ViRaL95
Copy link
Author

ViRaL95 commented Jan 8, 2020

I was able to reproduce it, but it is inconsistent. Every few times I run the program I get the error in the same place. Even though the stacktrace doesnt provide anything the reason I know its failing within the code sample is because of logging

@Nidhip21
Copy link

Nidhip21 commented Jan 27, 2022

Hi,
I am having a same issue. Any suggestion on how to resolve it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants