Massi
Posts: 1691
Joined: Fri May 02, 2014 1:52 pm
Location: Italy

help debugging mysql python script that hangs

Tue Apr 10, 2018 7:10 am

Hello,
i've a "curious" problem with my setup.

Raspberry pi (jessie)
python 3.5
a service that reads from mqtt topics and stores data on a mysql db
the db is in lan, on a qnap nas

Problem: it works, but after a "random" time, it simply hangs. it hangs while executing mysql commands. Linux says the service is active, but it's hung.
I can't find a way to debug this.
Any idea?

the code is really simple: it uses the "official" mysql module, in the connection config i have:
- raise on warning: true
- buffered: true
- a pool name
- pool size 16
- connection timeout 5

the code:
- mysql.connector.connect
- cursor
- cursor execute
- connection commit
- cursor close
-connection close

as i said, sometimes this works for some days flawlessly, other times this hangs after 15 minutes or so

Consider this is executing something like 10 insert queries every 5 minutes, so by far this is not a stressing condition.

Can this depend on the qnap nas itself?

help :(

Return to “Troubleshooting”