3

When running Rasa (tried on versions 1.3.3, 1.3.7, 1.3.8) I encounter this timeout exception message almost every time I make a call. I am running a simple program that recognises when a user offers their age, and stores the age in a database through an action response:

Bot loaded. Type a message and press enter (use '/stop' to exit):
Your input ->  I am 24 years old
2019-10-10 13:29:33 ERROR    asyncio  - Task exception was never retrieved
future: <Task finished coro=<configure_app.<locals>.run_cmdline_io() done, defined at /Users/Kami/Documents/rasa/venv/lib/python3.7/site-packages/rasa/core/run.py:123> exception=TimeoutError()>
Traceback (most recent call last):
  File "/Users/Kami/Documents/rasa/venv/lib/python3.7/site-packages/rasa/core/run.py", line 127, in run_cmdline_io
    server_url=constants.DEFAULT_SERVER_FORMAT.format("http", port)
  File "/Users/Kami/Documents/rasa/venv/lib/python3.7/site-packages/rasa/core/channels/console.py", line 138, in record_messages
    async for response in bot_responses:
  File "/Users/Kami/Documents/rasa/venv/lib/python3.7/site-packages/async_generator/_impl.py", line 366, in step
    return await ANextIter(self._it, start_fn, *args)
  File "/Users/Kami/Documents/rasa/venv/lib/python3.7/site-packages/async_generator/_impl.py", line 205, in throw
    return self._invoke(self._it.throw, type, value, traceback)
  File "/Users/Kami/Documents/rasa/venv/lib/python3.7/site-packages/async_generator/_impl.py", line 209, in _invoke
    result = fn(*args)
  File "/Users/Kami/Documents/rasa/venv/lib/python3.7/site-packages/rasa/core/channels/console.py", line 103, in send_message_receive_stream
    async for line in resp.content:
  File "/Users/Kami/Documents/rasa/venv/lib/python3.7/site-packages/aiohttp/streams.py", line 40, in __anext__
    rv = await self.read_func()
  File "/Users/Kami/Documents/rasa/venv/lib/python3.7/site-packages/aiohttp/streams.py", line 329, in readline
    await self._wait('readline')
  File "/Users/Kami/Documents/rasa/venv/lib/python3.7/site-packages/aiohttp/streams.py", line 297, in _wait
    await waiter
  File "/Users/Kami/Documents/rasa/venv/lib/python3.7/site-packages/aiohttp/helpers.py", line 585, in __exit__
    raise asyncio.TimeoutError from None
concurrent.futures._base.TimeoutError
Transport closed @ ('127.0.0.1', 63319) and exception experienced during error handling

Originally I thought this timeout was being caused by using large lookup tables for another part of my Rasa program, but for age recognition I am using a simple regex:

## regex:age
- ^(0?[1-9]|[1-9][0-9]|[1][1-9][1-9])$

And even this also causes the timeout.

Please help me solve this. I don't even need to avoid the timeout, I just want to know where I can catch/ignore this exception.

Thanks!

MrRedstone
  • 45
  • 1
  • 3

4 Answers4

5

I was fetching data from an API wherein I was getting a Timeout error because it was not able to fetch the data in the default time limit :

  1. Go to the directory: venv/Lib/site-packages/rasa/core/channels/console.py
  2. Change the default value of DEFAULT_STREAM_READING_TIMEOUT_IN_SECONDS to more than 10, in my case I changed it to 30 it worked.

    Another reason could be fetching of data again and again within a short period of time which could result in a timeout.
    Observations :
  • When DEFAULT_STREAM_READING_TIMEOUT_IN_SECONDS is set to 10 i get timeout error
  • When DEFAULT_STREAM_READING_TIMEOUT_IN_SECONDS is set to 30 and keep on running rasa shell again and again I get a timeout error
  • When DEFAULT_STREAM_READING_TIMEOUT_IN_SECONDS is set to 30 and run rasa shell not frequently it functions perfectly.
sauravjoshi23
  • 837
  • 11
  • 9
2

Make sure that you uncomment the below code

action_endpoint:
 url: "http://localhost:5055/webhook"

in the endpoints.yml. It is used when you are making custom actions to query database.

Vishal
  • 51
  • 5
1

I had the same problem and it was not solved by increasing timeout.

Make sure you are sending back a 'string' to the rasa shell from rasa action sever. What I mean is, if you are using 'text = ' in your utter_message, make sure that the async result is also a string and not just an object or something else. Change the type if required.

dispatcher.utter_message(text='has to be a string')

Running 'rasa shell -vv' showed me that it is receiving an object and that is why it is not able to parse it, hence timeout.

0

I can't comment now, but add followup to Vishal response. To check that hooks are present and waiting for connection you can use -vv command line switch. This display all available hooks at startup. For example:

2020-04-21 14:05:56 DEBUG    rasa.core.utils  - Available web server routes:
/webhooks/rasa                                     GET                            custom_webhook_RasaChatInput.health
/webhooks/rasa/webhook                             POST                           custom_webhook_RasaChatInput.receive
/webhooks/rest                                     GET                            custom_webhook_RestInput.health
/webhooks/rest/webhook                             POST                           custom_webhook_RestInput.receive
/                                                  GET                            hello
Mullo
  • 106
  • 5