How to prevent timeout while debugging actions?

I’ve started Rasa action server under debugging under Visual Studio Code. I’ve set a breakpoint, and started rasa shell to connect to it. After a couple of seconds, rasa shell raises a timeout error. Can I disable it?

I’ve tried to start the shell after setting the environment variable DEFAULT_STREAM_READING_TIMEOUT_IN_SECONDS to a high value, the the timeout persists. I believe there must be another way tho prevent the timeout

This may sound silly, but are you sure your breakpoint isn’t holding up your RASA action server and preventing it from responding? What happens if you remove the breakpoint and make both components work normally?

Yes, it is exactly what it is doing and what I want it to do. I want to be able to go step by step through the code while the robot is preparing its response.

During the step by step debugging I can change the behavior of the response, and would like to see how the flow of the dialog changes.

Usually it is possible to change the timeout value, but I just found the DEFAULT_STREAM_READING_TIMEOUT_IN_SECONDS configuration and it isn’t working.

Hi @neves, have you tried changing it via the --response-timeout CLI parameter? Make Rasa server response timeout configurable by mmalhotra · Pull Request #5358 · RasaHQ/rasa · GitHub

Unfortunately, it didn’t work.

I tried to pass the --response-timeout 3600 while starting rasa actions and it complained that the parameter didn’t exist. I’ve successfully ran rasa shell with it:

rasa shell \
  --response-timeout 3600\
  --debug \
  --endpoints endpoints-local.yml

but I’m still getting the timeout error in shell after some seconds. Here is the stack trace:

2020-04-22 15:47:41 DEBUG    rasa.core.actions.action  - Calling action endpoint to run action 'action_session_start'.
2020-04-22 15:47:50 ERROR    asyncio  - Task exception was never retrieved
future: <Task finished coro=<configure_app.<locals>.run_cmdline_io() done, defined at c:\anaconda3\envs\rasa\lib\site-packages\rasa\core\run.py:128> exception=TimeoutError()>
Traceback (most recent call last):
  File "c:\anaconda3\envs\rasa\lib\site-packages\rasa\core\run.py", line 134, in run_cmdline_io
    sender_id=conversation_id,
  File "c:\anaconda3\envs\rasa\lib\site-packages\rasa\core\channels\console.py", line 139, in record_messages  
    async for response in bot_responses:
  File "c:\anaconda3\envs\rasa\lib\site-packages\rasa\core\channels\console.py", line 105, in send_message_receive_stream
    async for line in resp.content:
  File "c:\anaconda3\envs\rasa\lib\site-packages\aiohttp\streams.py", line 39, in __anext__
    rv = await self.read_func()
  File "c:\anaconda3\envs\rasa\lib\site-packages\aiohttp\streams.py", line 328, in readline
    await self._wait('readline')
  File "c:\anaconda3\envs\rasa\lib\site-packages\aiohttp\streams.py", line 296, in _wait
    await waiter
  File "c:\anaconda3\envs\rasa\lib\site-packages\aiohttp\helpers.py", line 596, in __exit__
    raise asyncio.TimeoutError from None
concurrent.futures._base.TimeoutError
Transport closed @ ('127.0.0.1', 57052) and exception experienced during error handling

I searched the code and saw that the value is harcoded:

DEFAULT_STREAM_READING_TIMEOUT_IN_SECONDS = 10

I’ve changed it to

DEFAULT_STREAM_READING_TIMEOUT_IN_SECONDS = int( os.environ.get(“DEFAULT_STREAM_READING_TIMEOUT_IN_SECONDS”, 10) )

I’ll test it and if it works, I’ll clone the repo and send a pull request.

Good catch @neves! But that was actually just implemented a few days ago: make timeout for rasa shell configurable by wochinge · Pull Request #5686 · RasaHQ/rasa · GitHub

Hi, I exported RASA_SHELL_STREAM_READING_TIMEOUT_IN_SECONDS and ran rasa shell. It worked for me. NOTE: I am using Rasa 1.10.2

#export RASA_SHELL_STREAM_READING_TIMEOUT_IN_SECONDS=180

#rasa shell

2 Likes