# ChatBot not working on server - asyncio - Unclosed client session error

**URL:** <https://forum.rasa.com/t/chatbot-not-working-on-server-asyncio-unclosed-client-session-error/30083>\
**Category:** Rasa Open Source\
**Created:** [June 11, 2020, 12:18pm UTC](https://forum.rasa.com/t/chatbot-not-working-on-server-asyncio-unclosed-client-session-error/30083 "2020-06-11T12:18:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![pushkarpb](https://avatars.discourse-cdn.com/v4/letter/p/f475e1/32.png) [@pushkarpb](https://forum.rasa.com/u/pushkarpb)\
**Post date:** [June 11, 2020, 12:18pm UTC](https://forum.rasa.com/t/chatbot-not-working-on-server-asyncio-unclosed-client-session-error/30083/1 "2020-06-11T12:18:49Z")

</div>

I am building the rasa chatbot and trying to deploy it on messaging platforms like slack,telegram. The bot is working perfectly fine if I use ngrok for tunneling from my laptop onto slack. But when I deploy the same chatbot onto my server and run it, it returns with asyncio - Unclosed client session error.

For clarification, the server has a public url and i am able to do curl check onto it: ![rasa2](https://europe1.discourse-cdn.com/flex013/uploads/rasa/original/2X/0/093af8d4a5f610d6b8630299579282dcb35d701e.png)

It works

Also, the slack app installer has accepted my webhook url: ![rasa1](https://europe1.discourse-cdn.com/flex013/uploads/rasa/original/2X/2/2c14b4a34d56ecceae98c5a2e3886790a2f3d749.png)

But as soon as I send the text, it gives error in debug logs as :

**LOGS**

2020-06-11 06:34:22 DEBUG rasa.core.tracker\_store - Creating a new tracker for id ‘UM0UF59J5’. 2020-06-11 06:34:22 DEBUG rasa.core.processor - Starting a new session for conversation ID ‘UM0UF59J5’. 2020-06-11 06:34:22 DEBUG rasa.core.processor - Action ‘action\_session\_start’ ended with events ‘[\<rasa.core.events.SessionStarted object at 0x7fe9196ff7f0\>, \<rasa.core.events.ActionExecuted object at 0x7fe9196ffcc0\>]’. 2020-06-11 06:34:22 DEBUG rasa.core.processor - Current slot values: option\_form\_input1: None option\_form\_input2: None option\_form\_input3: None option\_form\_input4: None option\_form\_input5: None option\_selected: None requested\_slot: None wish\_chosen: None 2020-06-11 06:34:23 DEBUG rasa.nlu.classifiers.diet\_classifier - There is no trained model for ‘ResponseSelector’: The component is either not trained or didn’t receive enough training data. 2020-06-11 06:34:23 DEBUG rasa.nlu.selectors.response\_selector - Adding following selector key to message property: default 2020-06-11 06:34:23 DEBUG rasa.core.processor - Received user message ‘Hi’ with intent ‘{‘name’: ‘greet’, ‘confidence’: 0.9066393375396729}’ and entities ‘’ 2020-06-11 06:34:23 DEBUG rasa.core.processor - Logged UserUtterance - tracker now has 5 events. 2020-06-11 06:34:23 DEBUG rasa.core.policies.memoization - Current tracker state [None, None, None, {}, {‘prev\_action\_listen’: 1.0, ‘intent\_greet’: 1.0}] 2020-06-11 06:34:23 DEBUG rasa.core.policies.memoization - There is a memorised next action ‘utter\_welcome’ 2020-06-11 06:34:23 DEBUG rasa.core.policies.form\_policy - There is no active form 2020-06-11 06:34:23 DEBUG rasa.core.policies.ensemble - Predicted next action using policy\_0\_MemoizationPolicy 2020-06-11 06:34:23 DEBUG rasa.core.processor - Predicted next action ‘utter\_welcome’ with confidence 1.00. 2020-06-11 06:34:23 DEBUG rasa.core.processor - Action ‘utter\_welcome’ ended with events '[BotUttered('Welcome to your Job Profile assistant ‘, {“elements”: null, “quick\_replies”: null, “buttons”: null, “attachment”: null, “image”: null, “custom”: null}, {}, 1591875263.6727848)]’. 2020-06-11 06:34:25 DEBUG rasa.core.lock\_store - Deleted lock for conversation ‘UM0UF59J5’. /usr/local/lib64/python3.6/site-packages/aiohttp/client.py:309: ResourceWarning: Unclosed client session \<aiohttp.client.ClientSession object at 0x7fe9197a7b38\> \*\*kwargs) 2020-06-11 06:34:25 ERROR asyncio - Unclosed client session client\_session: \<aiohttp.client.ClientSession object at 0x7fe9197a7b38\> source\_traceback: Object created at (most recent call last): File “/usr/local/bin/rasa”, line 8, in sys.exit(main()) File “/usr/local/lib/python3.6/site-packages/rasa/ **main**.py”, line 91, in main cmdline\_arguments.func(cmdline\_arguments) File “/usr/local/lib/python3.6/site-packages/rasa/cli/run.py”, line 114, in run rasa.run(\*\*vars(args)) File “/usr/local/lib/python3.6/site-packages/rasa/run.py”, line 56, in run \*\*kwargs, File “/usr/local/lib/python3.6/site-packages/rasa/core/run.py”, line 216, in serve\_application endpoints.lock\_store if endpoints else None File “/usr/local/lib/python3.6/site-packages/sanic/app.py”, line 1167, in run serve(\*\*server\_settings) File “/usr/local/lib/python3.6/site-packages/sanic/server.py”, line 920, in serve loop.run\_forever() File “/usr/lib64/python3.6/asyncio/coroutines.py”, line 126, in send return self.gen.send(value) File “/usr/local/lib/python3.6/site-packages/slack/web/base\_client.py”, line 266, in \_send http\_verb=http\_verb, api\_url=api\_url, req\_args=req\_args File “/usr/lib64/python3.6/asyncio/coroutines.py”, line 110, in **next** return self.gen.send(None) File “/usr/local/lib/python3.6/site-packages/slack/web/base\_client.py”, line 293, in \_request auth=req\_args.pop(“auth”, None), 2020-06-11 06:34:25 ERROR rasa.core.channels.slack - Exception when trying to handle message. 2020-06-11 06:34:25 ERROR rasa.core.channels.slack - Traceback (most recent call last): File “/usr/local/lib/python3.6/site-packages/rasa/core/channels/slack.py”, line 312, in process\_message await on\_new\_message(user\_msg) File “/usr/lib64/python3.6/asyncio/coroutines.py”, line 129, in throw return self.gen.throw(type, value, traceback) File “/usr/local/lib/python3.6/site-packages/rasa/core/channels/channel.py”, line 83, in handler await app.agent.handle\_message(\*args, \*\*kwargs) File “/usr/lib64/python3.6/asyncio/coroutines.py”, line 129, in throw return self.gen.throw(type, value, traceback) File “/usr/local/lib/python3.6/site-packages/rasa/core/agent.py”, line 486, in handle\_message return await processor.handle\_message(message) File “/usr/lib64/python3.6/asyncio/coroutines.py”, line 129, in throw return self.gen.throw(type, value, traceback) File “/usr/local/lib/python3.6/site-packages/rasa/core/processor.py”, line 108, in handle\_message await self.\_predict\_and\_execute\_next\_action(message.output\_channel, tracker) File “/usr/lib64/python3.6/asyncio/coroutines.py”, line 129, in throw return self.gen.throw(type, value, traceback) File “/usr/local/lib/python3.6/site-packages/rasa/core/processor.py”, line 552, in \_predict\_and\_execute\_next\_action action, tracker, output\_channel, self.nlg, policy, confidence File “/usr/lib64/python3.6/asyncio/coroutines.py”, line 129, in throw return self.gen.throw(type, value, traceback) File “/usr/local/lib/python3.6/site-packages/rasa/core/processor.py”, line 665, in \_run\_action await self.\_send\_bot\_messages(events, tracker, output\_channel) File “/usr/lib64/python3.6/asyncio/coroutines.py”, line 129, in throw return self.gen.throw(type, value, traceback) File “/usr/local/lib/python3.6/site-packages/rasa/core/processor.py”, line 594, in \_send\_bot\_messages await output\_channel.send\_response(tracker.sender\_id, e.message()) File “/usr/lib64/python3.6/asyncio/coroutines.py”, line 129, in throw return self.gen.throw(type, value, traceback) File “/usr/local/lib/python3.6/site-packages/rasa/core/channels/channel.py”, line 186, in send\_response await self.send\_text\_message(recipient\_id, message.pop(“text”), \*\*message) File “/usr/lib64/python3.6/asyncio/coroutines.py”, line 129, in throw return self.gen.throw(type, value, traceback) File “/usr/local/lib/python3.6/site-packages/rasa/core/channels/slack.py”, line 39, in send\_text\_message channel=recipient, as\_user=True, text=message\_part, type=“mrkdwn”, concurrent.futures.\_base.CancelledError 2020-06-11 06:34:25 WARNING rasa.core.channels.slack - Received retry #1 request from slack due to http\_timeout.

**LOGS END**

Please help me out. The same error comes up when I deploy this on telegram that means there is not problem with a particular connector,

Also, one strange thing is that when I run a tunneling tool ie ngrok on my server machine and use that to deploy the bot on slack, it again starts working as normal.

Any help would be appreciated.

---

<div class="post-metadata">

**Author:** ![lluchini](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/lluchini/32/7609_2.png) [@lluchini](https://forum.rasa.com/u/lluchini)\
**Post date:** [June 11, 2020, 1:56pm UTC](https://forum.rasa.com/t/chatbot-not-working-on-server-asyncio-unclosed-client-session-error/30083/2 "2020-06-11T13:56:48Z")

</div>

Hello @pushkarpb,

Welcome to our community! 🥂

I did some research and this doesn’t seem to be a problem (or should be one).

If you could provide a virtual environment (or another way) with the simulation I can try to debug, fix, and submit a PR to RASA, if it is really a problem.

Cya!

---

<div class="post-metadata">

**Author:** ![pushkarpb](https://avatars.discourse-cdn.com/v4/letter/p/f475e1/32.png) [@pushkarpb](https://forum.rasa.com/u/pushkarpb)\
**Post date:** [June 14, 2020, 6:34am UTC](https://forum.rasa.com/t/chatbot-not-working-on-server-asyncio-unclosed-client-session-error/30083/3 "2020-06-14T06:34:22Z")

</div>

Hi @lluchini, Thanks for offering your help. If its okay, we can get on a zoom call or something on Monday and look at it together? You can send across email id if you want to sync up offline.

---

<div class="post-metadata">

**Author:** ![lluchini](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/lluchini/32/7609_2.png) [@lluchini](https://forum.rasa.com/u/lluchini)\
**Post date:** [June 15, 2020, 11:39am UTC](https://forum.rasa.com/t/chatbot-not-working-on-server-asyncio-unclosed-client-session-error/30083/4 "2020-06-15T11:39:56Z")

</div>

Hey @pushkarpb,

sure we can get on a call, no prob, but if you could provide you an environment for download I could try here before we get on a call, so I’ll have a baseline to discuss with you.

You don’t need to include your project files (nlu, domain, credentials), I can use mine and see if it’s a problem on environment ou something linked with you project, then we start 4 hands debug, what do you think?

Either way, contact me trought linkedin (it’s on my profile) and we continue from there, and after we solve this, we can post back here to help others.

Cya!
