Error asyncio - Task exception was never retrieved

  • OS: Windows 10

  • Python 3.8

  • Rasa 2.0.3

Hey,

I had successfully installed rasa then I ran rasa train and rasa run actions. Both successfully. After running rasa shell command I typed “Hello” in Your input and I got the error. I have seen few similar problems here or in Stack Overflow but it didn’t help. Here is my error:

PS E:\dev\project004> .\env\Scripts\activate
(env) PS E:\dev\project004> cd pokedex-demo
(env) PS E:\dev\project004\pokedex-demo> rasa shell
2020-11-06 21:47:13 INFO     root  - Connecting to channel 'cmdline' which was specified by the '--connector' argument. Any other channels will be ignored. To connect to all given channels, omit the '--connector' argument.
2020-11-06 21:47:13 INFO     root  - Starting Rasa server on http://localhost:5005
e:\dev\project004\env\lib\site-packages\rasa\shared\core\slots.py:256: FutureWarning: UnfeaturizedSlot is deprecated and will be removed in Rasa Open Source 3.0. Please change the type and configure the 'influence_conversation' flag for slot 'attribute' instead.
  rasa.shared.utils.io.raise_warning(
e:\dev\project004\env\lib\site-packages\rasa\shared\core\slots.py:256: FutureWarning: UnfeaturizedSlot is deprecated and will be removed in Rasa Open Source 3.0. Please change the type and configure the 'influence_conversation' flag for slot 'knowledge_base_last_object' instead.
  rasa.shared.utils.io.raise_warning(
e:\dev\project004\env\lib\site-packages\rasa\shared\core\slots.py:256: FutureWarning: UnfeaturizedSlot is deprecated and will be removed in Rasa Open Source 3.0. Please change the type and configure the 'influence_conversation' flag for slot 'knowledge_base_last_object_type' instead.
  rasa.shared.utils.io.raise_warning(
e:\dev\project004\env\lib\site-packages\rasa\shared\core\slots.py:256: FutureWarning: UnfeaturizedSlot is deprecated and will be removed in Rasa Open Source 3.0. Please change the type and configure the 'influence_conversation' flag for slot 'knowledge_base_listed_objects' instead.
  rasa.shared.utils.io.raise_warning(
e:\dev\project004\env\lib\site-packages\rasa\shared\core\slots.py:256: FutureWarning: UnfeaturizedSlot is deprecated and will be removed in Rasa Open Source 3.0. Please change the type and configure the 'influence_conversation' flag for slot 'mention' instead.
  rasa.shared.utils.io.raise_warning(
e:\dev\project004\env\lib\site-packages\rasa\shared\core\slots.py:256: FutureWarning: UnfeaturizedSlot is deprecated and will be removed in Rasa Open Source 3.0. Please change the type and configure the 'influence_conversation' flag for slot 'object_type' instead.
  rasa.shared.utils.io.raise_warning(
e:\dev\project004\env\lib\site-packages\rasa\shared\core\slots.py:256: FutureWarning: UnfeaturizedSlot is deprecated and will be removed in Rasa Open Source 3.0. Please change the type and configure the 'influence_conversation' flag for slot 'pokemon' instead.
  rasa.shared.utils.io.raise_warning(
e:\dev\project004\env\lib\site-packages\rasa\shared\core\slots.py:256: FutureWarning: UnfeaturizedSlot is deprecated and will be removed in Rasa Open Source 3.0. Please change the type and configure the 'influence_conversation' flag for slot 'pokemon_name' instead.
  rasa.shared.utils.io.raise_warning(
e:\dev\project004\env\lib\site-packages\rasa\core\policies\mapping_policy.py:51: FutureWarning: 'MappingPolicy' is deprecated and will be removed in the future. It is recommended to use the 'RulePolicy' instead. (will be removed in 3.0.0)
  rasa.shared.utils.io.raise_deprecation_warning(
2020-11-06 21:47:28 WARNING  rasa.shared.core.domain  - You are using an experiential feature: Action 'action_query_knowledge_base'!
2020-11-06 21:47:28 INFO     root  - Rasa server is up and running.
Bot loaded. Type a message and press enter (use '/stop' to exit): 
Your input ->  Hello                                                                                                                                            
2020-11-06 21:47:46 ERROR    asyncio  - Task exception was never retrieved
future: <Task finished name='Task-2' coro=<configure_app.<locals>.run_cmdline_io() done, defined at e:\dev\project004\env\lib\site-packages\rasa\core\run.py:133> exception=TimeoutError()>
Traceback (most recent call last):
  File "e:\dev\project004\env\lib\site-packages\rasa\core\run.py", line 137, in run_cmdline_io
    await console.record_messages(
  File "e:\dev\project004\env\lib\site-packages\rasa\core\channels\console.py", line 182, in record_messages
    async for response in bot_responses:
  File "e:\dev\project004\env\lib\site-packages\rasa\core\channels\console.py", line 137, in send_message_receive_stream
    async for line in resp.content:
  File "e:\dev\project004\env\lib\site-packages\aiohttp\streams.py", line 39, in __anext__
    rv = await self.read_func()
  File "e:\dev\project004\env\lib\site-packages\aiohttp\streams.py", line 328, in readline
    await self._wait('readline')
  File "e:\dev\project004\env\lib\site-packages\aiohttp\streams.py", line 296, in _wait
    await waiter
  File "e:\dev\project004\env\lib\site-packages\aiohttp\helpers.py", line 596, in __exit__
    raise asyncio.TimeoutError from None
asyncio.exceptions.TimeoutError

Thanks in advance

Seems there was a timeout error. How long is your custom action supposed to run? We have configured timeout of 10 seconds for rasa shell. You can change it by setting the env variable RASA_SHELL_STREAM_READING_TIMEOUT_IN_SECONDS.

I tried with 10, 30, 180 seconds but it didn’t help.

What is your custom action doing and how long does it take?

I’m not sure if that’s what you mean but in domain.yml is 60 seconds

domain.yml:

intents:

  - greet

  - goodbye

  - affirm

  - deny

  - bot_challenge

  - inform

  - thankyou

  - out_of_scope

entities:

  - exercise

  - sleep

  - stress

responses:

  utter_greet:

  - text: "Hi! It's time for your daily wellness check. Tracking healthy habits is a great way to measure your progress over time. Would you like to answer a few questions about your health?"

  utter_goodbye:

  - text: "See you tomorrow. Bye!"

  utter_iamabot:

  - text: "I am a bot, powered by Rasa."

  

  utter_ask_confirm_exercise:

  - text: Did you exercise yesterday? Don't sweat it if you didn't run a marathon - walks count!

  utter_ask_exercise:

  - text: What kind of exercise did you do 💪 ?

  utter_ask_sleep:

  - text: "How much sleep did you get 💤  last night?"

  utter_ask_diet:

  - text: "Did you stick to a healthy diet 🥦  yesterday?"

  utter_ask_stress:

  - text: "What is your stress level right now 🧘 ?"

    buttons:

      - title: "low"

        payload: '/inform{"stress": "low"}'

      - title: "medium"

        payload: '/inform{"stress": "medium"}'

      - title: "high"

        payload: '/inform{"stress": "high"}'

  utter_ask_goal:

  - text: "Setting goals - even small ones - is a great way to focus your day. What do you want to accomplish today 🥇 ?"

  utter_slots_values:

  - text: "You've submitted the following answers:\n

            - Exercised?: {confirm_exercise}\n

            - Type of exercise: {exercise}\n

            - Sleep: {sleep}\n

            - Stuck to a healthy diet?: {diet}\n

            - Stress level: {stress}\n

            - Goal: {goal}"

  utter_no_worries:

  - text: "No problem :)"

  utter_ask_continue:

  - text: "Sorry, I don't quite understand. Do you want to continue?"

slots:

  confirm_exercise:

    type: unfeaturized

  exercise:

    type: unfeaturized

  sleep:

    type: unfeaturized

  diet:

    type: unfeaturized

  stress:

    type: unfeaturized

  goal:

    type: unfeaturized

session_config:

  session_expiration_time: 60

  carry_over_slots_to_new_session: false

forms:

  - health_form

The problem seems to be that action_query_knowledge_base takes a long time to run and the default timeout of 10 seconds is raised. Do you know why this action takes such a long time?

@Tobias_Wochinger is there any solution for this issue?

I am also facing similar issue

  • OS: Windows 2016 server
  • Python 3.8.3
  • Rasa 2.0.3

I do not have any custom action just a plain install and added few example of response selector chitchat/faq

In actions.py file I found this:

class MyKnowledgeBaseAction(ActionQueryKnowledgeBase):
    def __init__(self):
        knowledge_base = InMemoryKnowledgeBase("data/pokemondb.json")
        super().__init__(knowledge_base)

I think there is a problem with pokemondb.json because this file is extremely big. It has 22,000 lines of code. So this action must take such a long time.

Mhm, in that case I’d try to find a way to accelerate this somehow.