MySQL and InfluxDB timeouts

I run a web.py server on my machine, which constantly receives POST data and stores some data in MySQL (5.7.19) and some in InfluxDB (1.3.1) hosted on a remote server running Ubuntu (16.04.1).

I also have a Python script running locally, fetching InfluxDB data and manipulating MySQL data. This python script creates new connections to both bases every time its main function starts (closing them also every time), which can be up to 10 times per second. I am using MySQLdb and InfluxDB Python APIs.

The problem is that after a while, I periodically get connection timeouts to both databases.

This is what the error messages look like:

MySQL: OperationalError: (1205, "Lock wait timeout exceeded, please try reloading transaction ')

InfluxDB: InfluxDBServerError: {"error": "timeout"}

After thoroughly examining all of my code, I cannot find the cause of this problem. Does MySQL and Influx, or maybe even Ubuntu have a connection limit per user and time?

When it comes to MySQL, some rows are locked using a SELECT FOR UPDATE query, but in the code, all transactions are either fixed or rolled back. If the connection is lost before committing or rolling back, this explains the MySQL timeouts, as it will try to access the locked row that will not be unlocked properly.

When it comes to InfluxDB, we're just dealing with atomic inserts which don't make any sense to me.

If anyone knows what might be causing these timeouts, I'd be eternally grateful!

+3
mysql ubuntu mysql-python influxdb influxdb-python


source to share


No one has answered this question yet

Check out similar questions:

2568
Should I be using the datetime or timestamp datatype in MySQL?
1762
How to import SQL file using command line in MySQL?
1290
How do I get a list of user accounts using the command line in MySQL?
1105
How to reset AUTO_INCREMENT in MySQL?
1086
How to connect to MySQL database in Python?
758
pip install mysql-python doesn't work with EnvironmentError: mysql_config not found
3
'Error: The command used is not allowed with this MySQL version' by mysqldb
1
MySQLdb UPDATE hangs
1
InfluxDB [Error: No host]
0
How do I access the mysql database?



All Articles
Loading...
X
Show
Funny
Dev
Pics