I have a command-line script that uses Django's ORM. For reasons
beyond my comprehension, it has a tendency to get "stuck" in
transactions. When I check the postgre server status, it simply shows
a connection that is "idle in transaction" and never completes. The
script ends up hitting this wall seemingly randomly, as far as I can
tell. Sometimes it makes it through 1000 iterations before it happens,
sometimes it makes it through 10.

I've tried using transaction decorators, such as
`transaction.commit_on_success`. Decorating every orm-using function
with this increased the successful number of iterations, but it didn't
fix the problem. The script doesn't do anything fancy; some simple
filter()s, beyond that just save() and delete(). Short of replacing
every ORM usage with straight psycopg2, I'm not really sure what to do
here.

Just to reiterate, this isn't an issue with orphaned connections or
anything like that. The script loops through some files, parses them,
and makes ORM calls. Sooner or later, it stops looping and gets stuck
in a transaction and the only way to fix it is to terminate the script.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to