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

SSL Errors #14

Open
AlexBurkey opened this issue May 29, 2020 · 2 comments
Open

SSL Errors #14

AlexBurkey opened this issue May 29, 2020 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@AlexBurkey
Copy link
Owner

Describe the bug
Bot restarts frequently due to some SSL error I haven't quite figured out yet.

To Reproduce
Any information necessary to create the bug.

Expected behavior
A clear and concise description of what you expected to happen.

Comment Link
Please include a link to the comment you made that caused the issue.

Additional context
Trace:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 159, in _new_conn
    (self._dns_host, self.port), self.timeout, **extra_kw)
  File "/usr/lib/python3/dist-packages/urllib3/util/connection.py", line 57, in create_connection
    for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
  File "/usr/lib/python3.7/socket.py", line 748, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -3] Temporary failure in name resolution

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 600, in urlopen
    chunked=chunked)
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 343, in _make_request
    self._validate_conn(conn)
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 841, in _validate_conn
    conn.connect()
  File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 301, in connect
    conn = self._new_conn()
  File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 168, in _new_conn
    self, "Failed to establish a new connection: %s" % e)
urllib3.exceptions.NewConnectionError: <urllib3.connection.VerifiedHTTPSConnection object at 0x75cfa550>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/pi/.local/lib/python3.7/site-packages/requests/adapters.py", line 449, in send
    timeout=timeout
  File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 638, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/usr/lib/python3/dist-packages/urllib3/util/retry.py", line 398, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='www.reddit.com', port=443): Max retries exceeded with url: /api/v1/access_token (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x75cfa550>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/pi/.local/lib/python3.7/site-packages/prawcore/requestor.py", line 53, in request
    return self._http.request(*args, timeout=timeout, **kwargs)
  File "/home/pi/.local/lib/python3.7/site-packages/requests/sessions.py", line 530, in request
    resp = self.send(prep, **send_kwargs)
  File "/home/pi/.local/lib/python3.7/site-packages/requests/sessions.py", line 643, in send
    r = adapter.send(request, **kwargs)
  File "/home/pi/.local/lib/python3.7/site-packages/requests/adapters.py", line 516, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='www.reddit.com', port=443): Max retries exceeded with url: /api/v1/access_token (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x75cfa550>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "bot.py", line 259, in <module>
    for comment in r.subreddit(SUBREDDIT_NAME).stream.comments():
  File "/home/pi/.local/lib/python3.7/site-packages/praw/models/util.py", line 186, in stream_generator
    for item in reversed(list(function(limit=limit, **function_kwargs))):
  File "/home/pi/.local/lib/python3.7/site-packages/praw/models/listing/generator.py", line 61, in __next__
    self._next_batch()
  File "/home/pi/.local/lib/python3.7/site-packages/praw/models/listing/generator.py", line 71, in _next_batch
    self._listing = self._reddit.get(self.url, params=self.params)
  File "/home/pi/.local/lib/python3.7/site-packages/praw/reddit.py", line 490, in get
    return self._objectify_request(method="GET", params=params, path=path)
  File "/home/pi/.local/lib/python3.7/site-packages/praw/reddit.py", line 574, in _objectify_request
    data=data, files=files, method=method, params=params, path=path
  File "/home/pi/.local/lib/python3.7/site-packages/praw/reddit.py", line 732, in request
    timeout=self.config.timeout,
  File "/home/pi/.local/lib/python3.7/site-packages/prawcore/sessions.py", line 336, in request
    url=url,
  File "/home/pi/.local/lib/python3.7/site-packages/prawcore/sessions.py", line 262, in _request_with_retries
    url,
  File "/home/pi/.local/lib/python3.7/site-packages/prawcore/sessions.py", line 170, in _do_retry
    retry_strategy_state=retry_strategy_state.consume_available_retry(),  # noqa: E501
  File "/home/pi/.local/lib/python3.7/site-packages/prawcore/sessions.py", line 262, in _request_with_retries
    url,
  File "/home/pi/.local/lib/python3.7/site-packages/prawcore/sessions.py", line 170, in _do_retry
    retry_strategy_state=retry_strategy_state.consume_available_retry(),  # noqa: E501
  File "/home/pi/.local/lib/python3.7/site-packages/prawcore/sessions.py", line 235, in _request_with_retries
    url,
  File "/home/pi/.local/lib/python3.7/site-packages/prawcore/sessions.py", line 195, in _make_request
    timeout=timeout,
  File "/home/pi/.local/lib/python3.7/site-packages/prawcore/rate_limit.py", line 35, in call
    kwargs["headers"] = set_header_callback()
  File "/home/pi/.local/lib/python3.7/site-packages/prawcore/sessions.py", line 282, in _set_header_callback
    self._authorizer.refresh()
  File "/home/pi/.local/lib/python3.7/site-packages/prawcore/auth.py", line 352, in refresh
    password=self._password,
  File "/home/pi/.local/lib/python3.7/site-packages/prawcore/auth.py", line 149, in _request_token
    response = self._authenticator._post(url, **data)
  File "/home/pi/.local/lib/python3.7/site-packages/prawcore/auth.py", line 29, in _post
    "post", url, auth=self._auth(), data=sorted(data.items())
  File "/home/pi/.local/lib/python3.7/site-packages/prawcore/requestor.py", line 55, in request
    raise RequestException(exc, args, kwargs)
prawcore.exceptions.RequestException: error with request HTTPSConnectionPool(host='www.reddit.com', port=443): Max retries exceeded with url: /api/v1/access_token (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x75cfa550>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution'))
@AlexBurkey
Copy link
Owner Author

Leaving this open for now, but I changed the user_agent in praw.ini from test (duh) to mfaimagebot. I suspect lots of other people are using test so hopefully a more unique user agent will resolve this.

See this thread: https://www.reddit.com/r/redditdev/comments/9mkjiq/error_httpsconnectionpoolchange_max_retries/

@AlexBurkey
Copy link
Owner Author

AlexBurkey commented May 29, 2020

Might need to configure a cert for this as well, but that's more complicated so I'll just watch for more of these errors for now.

https://stackoverflow.com/questions/21655478/sslerror-with-praw/50160417#50160417
praw-dev/praw#934

@AlexBurkey AlexBurkey added the bug Something isn't working label May 30, 2020
@AlexBurkey AlexBurkey self-assigned this May 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant