# Multi Threading problem

**URL:** https://forum.rasa.com/t/multi-threading-problem/32979
**Category:** Rasa Open Source
**Created:** [August 25, 2020, 1:52pm UTC](https://forum.rasa.com/t/multi-threading-problem/32979 "2020-08-25T13:52:14Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![wassimgt](https://avatars.discourse-cdn.com/v4/letter/w/439d5e/32.png) [@wassimgt](https://forum.rasa.com/u/wassimgt)
#### Post date: [August 25, 2020, 1:52pm UTC](https://forum.rasa.com/t/multi-threading-problem/32979/1 "2020-08-25T13:52:15Z")

</div>

Hi, I have an **action** that takes about 2 minutes to respond. During this time the chatbot is not able to process other users for another action until the **action** completes. **Do you have any solutions please**? @erohmensing

---

<div class="post-metadata">

### Author: ![vi.kumar](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/vi.kumar/32/9047_2.png) [@vi.kumar](https://forum.rasa.com/u/vi.kumar)
#### Post date: [August 26, 2020, 4:41am UTC](https://forum.rasa.com/t/multi-threading-problem/32979/2 "2020-08-26T04:41:58Z")

</div>

Hi @wassimgt  
I am also facing the sane issue  
If u get the solution kindly share   
Thanks

---

<div class="post-metadata">

### Author: ![erohmensing](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/erohmensing/32/1789_2.png) [@erohmensing](https://forum.rasa.com/u/erohmensing)
#### Post date: [August 27, 2020, 7:54am UTC](https://forum.rasa.com/t/multi-threading-problem/32979/3 "2020-08-27T07:54:36Z")

</div>

Hi @wassimgt @vi.kumar. What part of your action takes 2 minutes to respond? Are you doing 2 minutes of processing _within_ your action server, or are you calling another endpoint from your action server that takes 2 minutes to return?

If the second, I recommend you make your `run` method `async` (which is available by default in rasa sdk \> 1.6) and `await` the result of your long-running endpoint

---

<div class="post-metadata">

### Author: ![wassimgt](https://avatars.discourse-cdn.com/v4/letter/w/439d5e/32.png) [@wassimgt](https://forum.rasa.com/u/wassimgt)
#### Post date: [August 27, 2020, 2:42pm UTC](https://forum.rasa.com/t/multi-threading-problem/32979/4 "2020-08-27T14:42:05Z")

</div>

@erohmensingI spoke the other time here on my chatbot and the timeout problem,

> [@Problem timeout webhook fb messanger](http://forum.rasa.com/t/problem-timeout-webhook-fb-messanger/31838):
>
> Hi, My custom action takes a long time in the response because I have a great deal of treatment in it. The problem that the Fb messenger webhook sends a post every 20 seconds until the custom action sends the response. This problem will do this : doc fb messanger webhook can you help me ?

the problem when I call another action after the prediction action (running)

---

<div class="post-metadata">

### Author: ![vi.kumar](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/vi.kumar/32/9047_2.png) [@vi.kumar](https://forum.rasa.com/u/vi.kumar)
#### Post date: [September 28, 2020, 6:01am UTC](https://forum.rasa.com/t/multi-threading-problem/32979/5 "2020-09-28T06:01:17Z")

</div>

Hi @erohmensing  
My Query is -  
RASA actions server perform the requests sequentially . If one action(say “action\_1”) is under progress and in between if another user called another action (say “action\_2”) . I found that **rasa action server first complete action\_1 and then process action\_2.**  
My requirements- I want rasa actions server to perform both actions parallelly , if this doesn’t happen then users will remain in waiting queue for a long time if number of users increase .  
For reference, I am providing u the logs :  
My rasa model server has these properties:  
2020-08-26 17:39:46 DEBUG rasa.core.tracker\_store - Attempting to connect to database via ‘sqlite://:\*\*\*@/rasa\_server.db’.  
2020-08-26 17:39:46 DEBUG rasa.core.tracker\_store - Connection to SQL database ‘rasa\_server.db’ successful.  
2020-08-26 17:39:46 DEBUG rasa.core.tracker\_store - Connected to SQLTrackerStore.  
2020-08-26 17:39:46 DEBUG rasa.core.lock\_store - Connected to lock store ‘InMemoryLockStore’.\

For two queries : i am giving you logs of rasa server and actions server.  
**Logs of rasa Model server** -  
Here u can see there are two users with sender\_id {sbm.kumar , vi.kumar}  
And two Queries - “Find Issues” and “Prediction Issues”\

for “ **find Issues** ” -  
intent - ask\_find\_issues\_part  
action - action\_find\_issues\_part\

for “ **Prediction Issues** ” -  
intent - ask\_predict\_issues\_part  
action - action\_predict\_issues\_part  
sbm.kumar request for “Prediction Issues” functionality which comes at 17:52:50  
vi.kumar request for “Find Issues” functionality which comes at 17:52:53\

2020-08-26 17:52:50 DEBUG rasa.core.tracker\_store - Recreating tracker from sender id ‘sbm.kumar’ 2020-08-26 **17:52:50** DEBUG rasa.core.processor - Received user message ‘/ask\_predict\_issues\_part’ 2020-08-26 **17:52:50** DEBUG rasa.core.actions.action - Calling action endpoint to run action ‘action\_predict\_issues\_part’.

2020-08-26 17:52:53 DEBUG rasa.core.tracker\_store - Recreating tracker from sender id ‘vi.kumar’ 2020-08-26 **17:52:53** DEBUG rasa.core.processor - Received user message ‘/ask\_find\_issues\_part’ 2020-08-26 **17:52:53** DEBUG rasa.core.actions.action - Calling action endpoint to run action ‘action\_find\_issues\_part’.\

**Logs of rasa actions server** -  
At 17:52:39 - “ **Prediction Issues** ” functionality executes.  
“api for predicting issues is called.” this api takes time to fetch result .  
Until this api is completed there is no log of “ **Find Issues** ” custom action.  
U can check this from timestamp.  
Once “action\_predict\_issues\_part” completes then at 17:53:52 “action\_find\_issues\_part” starts\

[2020-08-26 **17:52:39**] “POST /webhook HTTP/1.1” 200 1842 0.019000  
action\_predict\_issues\_part  
api for predicting issues is called.  
action\_completed

[2020-08-26 17:53:52] “POST /webhook HTTP/1.1” 200 12050 62.046102  
action\_find\_issues\_part  
action\_completed

My Observations-  
The behaviour of Rasa Model server is Async and Parallel ,  
But behaviour of Rasa Actions server to execute custom actions is sequential\

Kindly tell me what i can do or am i missing anything to make you understand my query.
