Hey there guys,

I'm happy to say that we've finally figured out the bug. It was never an 
error with the underlying DBMS or Django itself. It was our code. It's sad 
that we didn't figure it out sooner and had to spend so many man hours on 
this. 

As I said, the *select_for_update *was never a problem to begin with. The 
TransactionManagementError was due to us executing queries inside 
Transaction block even after the transaction had rollbacked due to some 
reason (which we couldn't figure out). After having PSQL log all queries, 
we realized someone was sending an explicit rollback message after we do a 
SELECT COUNTER(*) (etither Django or our code). We thought it was some 
hidden bug with Django while using aggregation. 

We test the result of the SELECT statement and deny the request (or so we 
thought we did). We properly rollback and then instead of returning a 
*Response*, we just continued forward issuing more queries. Thankfully, the 
TransactionManagementError helped us and resulted in us not losing any 
data. Bottom line, if you guys face this error, make sure your user code is 
correct and you are doing everything as expected. Also, try logging the 
DBMS to see whether error is originating so you can narrow it down further.

Thanks to all those who helped. I did learn a whole lot over this process, 
and for that I'm glad.

-- 
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 django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/680a4bd8-f433-4a65-8f98-da10919765b5%40googlegroups.com.

Reply via email to