Hi! I run rasa on the server with MySQL Database and everything is fine, but when I not contact with bot for 8 hours and then write a message - an error occurs.
2021-08-22 17:19:11 ERROR rasa.core.tracker_store - Error happened when trying to save conversation tracker to ‘SQLTrackerStore’. Falling back to use the ‘InMemoryTrackerStore’. Please investigate the following error: (pymysql.err.OperationalError) (2006, “MySQL server has gone away (BrokenPipeError(32, ‘Broken pipe’))”)
[SQL: INSERT INTO events (sender_id, data) VALUES (%(sender_id)s, %(data)s)]
[parameters: {‘sender_id’: ‘761f83a0a14f4198807cbc303eab8be2’, ‘data’: ‘{“sender_id”: “761f83a0a14f4198807cbc303eab8be2”, “event”: “action”, “timestamp”: 1629670751.6087387, “name”: “action_session_start”, “policy”: null, “confidence”: 1.0, “action_text”: null, “hide_rule_turn”: false}’}]
(Background on this error at: http://sqlalche.me/e/13/e3q8).
I find solution in sqlalchemy on create_engine, need add two parameters, use pool_pre_ping and pool_recycle .
@Horizon733 MySQL Workbench, MongoDB and Reddis is also supported. I had worked with these PostgreSQL, Oracle, SQLite is default (rasa), MySQL Workbench and MongoDB.
@cristianccq I hope you looking this? or I got you wrong?
For storing the bot/user conversation you can use tracker store:
Update this code in endpoints.yml
For Postgres:
tracker_store:
type: SQL
dialect: "postgresql" # the dialect used to interact with the db
url: "localhost" # (optional) host of the sql db, e.g. "localhost"
db: "chatbot" # path to your db
username: "postgres" # username used for authentication
password: "123" # password used for authentication
# query: # optional dictionary to be added as a query string to the connection URL
# driver: my-driver
For MySQL:
tracker_store:
type: SQL
dialect: "mysql+pymysql" # the dialect used to interact with the db
url: "localhost" # (optional) host of the sql db, e.g. "localhost"
db: "rasa" # path to your db
username: "root" # username used for authentication
password: "root" # password used for authentication
Note: You also can need to install psycopg2-binary and pymysql. You will see when it will thrown error.
tracker_store:
type: SQL
dialect: "mysql+pymysql" # the dialect used to interact with the db
url: "192.168.21.76" # (optiona$
port: 3306
db: "rasa_core" # path to your db
username: "root" # username used for authentication
password: "root"
With this configuration after 8 hours I have a connection loss in mysql.
I have no way to set the configuration in sqlalchemy for mysql.
I am in a local development environment, later I will use docker for my MySQL instance together with another Docker Rasa-Core and Docker Rasa-Action-Server
Hi @nik202 ,
I’m testing for production environment.
As usual production-ready programs need to override these defaults (to fine-tune pools to their needs), most of the different implementations of connection pools provide a similar set of configuration options. The following list shows the most common options with their descriptions:
pool_size: Sets the number of connections that the pool will handle.
max_overflow: Specifies how many exceeding connections (relative to pool_size) the pool supports.
pool_recycle: Configures the maximum age (in seconds) of connections in the pool.
pool_timeout: Identifies how many seconds the program will wait before giving up on getting a connection from the pool.