3

I'm still a little new to Django, and I'm getting (1205, 'Lock wait timeout exceeded; try restarting transaction') when I try to update my model via the admin interface. Earlier today, it was working, and I've been rolling back changes to the last working version to try to narrow down what seems to be the issue.

The problem seems to be it failing to update and timing out. Just editing and hitting save in via the admin interface is triggering this issue. I've disabled any signal handling (post/presave) I had setup, but I think just the UPDATE call after hitting save changes is triggering this issue.

I've looked into it and can kill the process after following this link: Getting "Lock wait timeout exceeded; try restarting transaction" even though I'm not using a transaction

But it doesn't solve the problem. I can kill the process while it's going, but it's the only running query, and not even a big one at that.

The model only has 7 fields, describing VPN servers I'm cataloguing. A show processlist gives me this:

updating | UPDATE openvpn_client SET name = 'rsa_test1', local_ip = '2.2.2.2', vpn_ip = NULL, type =

The end gets cut off in the table, but I'm assuming it has the rest there.

I've considered it being a size problem, but I only have 4 entries so far in my table for 'Clients', and none of them store any sort of large data.

So far, I'm thinking it's a mySQL problem, and not a Django one, and have half a mind to start over with a new database.

I'm not looking to increase the timeout value since it used to run in less than a second to update these fields, so not quite sure what's changed since then.

kckaiwei
  • 416
  • 7
  • 18

1 Answers1

6

Turns out, post_save signal had bad code that was blocking (incomplete Celery task). Was under the impression that the signal is received after that was complete, but it seems to not be the case.

kckaiwei
  • 416
  • 7
  • 18
  • 1
    Had been stuck with for close to 2 days now! Even though I had commented out all the “delay” task, o missed out 1 model and that played havoc. Thank you – kopos Jan 08 '21 at 14:24