Friday, October 27, 2023

How to fix deadlocks with tests?

I'm experiencing deadlocks in my production application occasionally. I'm
using MySQL. Some of these deadlocks are due to insufficient indexing,
and I'd like to fix this with some test-driven development.

How can I write tests that exercise the application concurrently, and
could be used to replicate the deadlocks and then fix them? I use
pytest-django and I use MySQL in my tests; there's a lot of raw SQL and
even some views and stored procedures (😱) in this application and some
of those may be culprits too of course.

I suppose my main question is "how to test bugs that occur due to


You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit

No comments:

Post a Comment