When I use select_for_update
on a particular key, the call never returns.
A regular select works:
MyModel.objects.get(pk=pk_1) # Works
But select_for_update
doesn't:
with transaction.atomic():
MyModel.objects.select_for_update().get(pk=pk_1) # Blocks forever
If I change pk_1
to another key, it works. I am not sure why the row would be locked. There are no other connections to the database (to be certain of this I have reset all machines with database access, but the call still blocks for this particular key).
What could be the cause of this?