python-slack-sdk: Intermittent concurrent.futures._base.TimeoutError with run_async=True
Description
When i try to post a message to slack channel using one of the basic example to post a message to a channel, i see an error saying “concurrent.futures._base.TimeoutError”. I am using python 3.6.7 on Ubuntu 18.0.4 with slackclient 2.
What type of issue is this? (place an x
in one of the [ ]
)
- bug
- enhancement (feature request)
- question
- documentation related
- testing related
- discussion
Requirements (place an x
in each of the [ ]
)
- I’ve read and understood the Contributing guidelines and have done my best effort to follow them.
- I’ve read and agree to the Code of Conduct.
- I’ve searched for any related issues and avoided creating a duplicate issue.
Bug Report
Filling out the following details about bugs will help us solve your issue sooner.
Reproducible in:
slackclient version: 2
python version: 3.6.7
OS version(s): Ubuntu 18.0.4
Steps to reproduce:
- Set up virtualenv with python 3.6.7
- Example code from tutorial
- python3 testnotify.py
My Code:
import slack
client = slack.WebClient(token='SLACK_API_TOKEN')
response = client.chat_postMessage(
channel='#sm-test',
text="Hello world!")
assert response["ok"]
assert response["message"]["text"] == "Hello world!"
Expected result:
I am expecting to see the message ‘Hello World!’ posted to the slack channel ‘#sm-test’
Actual result:
I am seeing the following Error:
Traceback (most recent call last):
File "testnotify.py", line 9, in <module>
text="Hello world!")
File "/usr/local/lib/python3.6/dist-packages/slack/web/client.py", line 332, in chat_postMessage
return self.api_call("chat.postMessage", json=kwargs)
File "/usr/local/lib/python3.6/dist-packages/slack/web/base_client.py", line 154, in api_call
return self._event_loop.run_until_complete(future)
File "/usr/lib/python3.6/asyncio/base_events.py", line 473, in run_until_complete
return future.result()
File "/usr/local/lib/python3.6/dist-packages/slack/web/base_client.py", line 211, in _send
http_verb=http_verb, api_url=api_url, req_args=req_args
File "/usr/local/lib/python3.6/dist-packages/slack/web/base_client.py", line 240, in _request
async with session.request(http_verb, api_url, **req_args) as res:
File "/usr/local/lib/python3.6/dist-packages/aiohttp/client.py", line 1005, in __aenter__
self._resp = await self._coro
File "/usr/local/lib/python3.6/dist-packages/aiohttp/client.py", line 575, in _request
break
File "/usr/local/lib/python3.6/dist-packages/aiohttp/helpers.py", line 585, in __exit__
raise asyncio.TimeoutError from None
concurrent.futures._base.TimeoutError
Attachments:
Logs, screenshots, screencast, sample project, funny gif, etc.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 14
- Comments: 36 (12 by maintainers)
@romutchio If you want to use
run_async=True
(= use aiohttp), this issue is not yet fixed. If you don’t have the intention to use aiohttp/asyncio for API requests, try the latest one (v2.7.1).@seratch Well, how to fix this problem? Which version of slackclient i should use?
I reran my Web API synchronous processes, mostly conversations_replies() and conversations_history(), with this patch for the last two days and the issue appears to be fixed for me. (Previously the TimeoutError would occur within an hour). Looking forward to v2.6. Thanks!
@Marc-Girard HI, I am facing the same issue as well. import slack
client = slack.WebClient(token=‘SLACK_API_TOKEN’) response = client.chat_postMessage( channel=‘#mychannel’, text=“Hello world!”) assert response[“ok”] assert response[“message”][“text”] == “Hello world!”
version: Python: 3.7.x slack: 2.3.1 websocket-client: 0.54.0
Please help, as I am not able to proceed on further development. TIA.
I’m using the WebClient exclusively. So yes, I’m experiencing those issues with WebClient.