Report this

What is the reason for this report?

Intermittent 500 error when inserting into MySQL from Python Flask App

Posted on August 5, 2019

I keep getting a 500 issue when inserting data into MySql DB. I know when the issue occurs but can’t figure out why.

When I insert data (e.g. new user) into my DB, I can see it has been inserted correctly from MySql Workbench but about 50% of the time a 500 error is returned which says that the entry doesn’t exist. When you refresh the page it randomly comes and goes.

After I restart uwsgi (service uwsgi restart) and use the app again, it works as expected until I add some more data then the issue occurs again but only for data inserted after the restart.

The app works as expected when running on my local windows machine.

Would really appreciate any help on this before my head explodes!



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hi ollieb,

can you provide us with the mysql error log. The error should be logged and it can help us troubleshoot the issue. The error log itself and it’s path should be configured in your /etc/my.cnf file

Other than that, I would suggest your memory is running out.

To confirm that, you can check your /var/log/messages and see if there are any kill and oom signals.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.