Intermittent 500 error when inserting into MySQL from Python Flask App

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!

Submit an answer

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!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

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.