Running django through gunicorn in RDS (AWS mysql), I see this error in my shooting logs:
Exception _mysql_exceptions.ProgrammingError: (2014, "Commands out of sync; you can't run this command now") in <bound method Cursor.__del__ of <MySQLdb.cursors.Cursor object at 0x690ecd0>> ignored
I can not reliably reproduce it and I can not trace the source code that calls it.
I use source cursors in some places, following this pattern:
cursor = connections['read_only'].cursor() sql = "select username from auth_user;" cursor.execute(sql) rows = cursor.fetchall() usernames = [] for row in rows: usernames.append(row[0])
In some places, I immediately reuse the cursor for another execute () / fetchall () template. Sometimes I donβt do it.
I also use raw manager requests in some place.
I don't explicitly close the cursors, but I don't think I should.
Other than that: I do not use any stored procedures, init_command parameters and everything that is indicated in other answers that I saw here.
Any ideas or suggestions for debugging would be appreciated.
source share