slackapi / bolt-python

A framework to build Slack apps using Python
https://tools.slack.dev/bolt-python/
MIT License
1.07k stars 246 forks source link

Getting error "urlopen error [Errno -5] No address associated with hostname" #1182

Open PrajwalNaik07 opened 1 month ago

PrajwalNaik07 commented 1 month ago

I am running my slack app on the GCP kubernetes environment in socket mode, with 10 sockets open simultaneously.

Lately we have seen the bot failing to work and gives the following error:

Failed to send a request to Slack API server: <urlopen error [Errno -5] No address associated with hostname>
2024-10-15 22:56:18 UTC [INFO] A retry handler found: ConnectionErrorRetryHandler for POST https://slack.com/api/reactions.get - <urlopen error [Errno -5] No address associated with hostname>
2024-10-15 22:56:19 UTC [INFO] Going to retry the same request: POST https://slack.com/api/reactions.get
2024-10-15 22:56:19 UTC [ERROR] Failed to send a request to Slack API server: <urlopen error [Errno -5] No address associated with hostname>
2024-10-15 22:56:19 UTC [ERROR] Failed to run listener function (error: <urlopen error [Errno -5] No address associated with hostname>)
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/urllib/request.py", line 1346, in do_open
    h.request(req.get_method(), req.selector, req.data, headers,
  File "/usr/local/lib/python3.9/http/client.py", line 1285, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/local/lib/python3.9/http/client.py", line 1331, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/local/lib/python3.9/http/client.py", line 1280, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/local/lib/python3.9/http/client.py", line 1040, in _send_output
    self.send(msg)
  File "/usr/local/lib/python3.9/http/client.py", line 980, in send
    self.connect()
  File "/usr/local/lib/python3.9/http/client.py", line 1447, in connect
    super().connect()
  File "/usr/local/lib/python3.9/http/client.py", line 946, in connect
    self.sock = self._create_connection(
  File "/usr/local/lib/python3.9/socket.py", line 823, in create_connection
    for res in getaddrinfo(host, port, 0, SOCK_STREAM):
  File "/usr/local/lib/python3.9/socket.py", line 954, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -5] No address associated with hostname

**Using python packege versions:

slack_bolt==1.19.0 slack_sdk==3.30.0**

Could you let us know the cause and resolution for the same

seratch commented 1 month ago

Hi @PrajwalNaik07, the "No address associated with hostname" error indicates an issue with DNS resolution or something like that within your Kubernetes cluster network infra. Searching by "No address associated with hostname" on the internet will help you find many Q&A threads on this topic.

Unfortunately, we're unable to provide more specific guidance on this topic. I hope you find a suitable solution soon!

github-actions[bot] commented 1 week ago

👋 It looks like this issue has been open for 30 days with no activity. We'll mark this as stale for now, and wait 10 days for an update or for further comment before closing this issue out. If you think this issue needs to be prioritized, please comment to get the thread going again! Maintainers also review issues marked as stale on a regular basis and comment or adjust status if the issue needs to be reprioritized.