Hi,

here some thoughts how to debug this:

In postgres enable the logging of the executed statements.
On my system they go to /var/log/messsages.
Which statement is the last?

Are there any other db clients which access the database? Or are
you connecting from the same python script? Which transaction
isolation level do you use?

I use commit_on_success only once per call stack. This means,
there are the real methods which don't have the decorator. They
can be called from the web (here the transaction middleware does
the commit/rollback). And you have a simple command line python
script with a wrapper which has the commit_on_success decorator.

If you use unix, start the script with "strace -f" to see in which
system call the process stops.

 HTH,
   Thomas


Tom Davis schrieb:
> 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.

-- 
Thomas Guettler, http://www.thomas-guettler.de/
E-Mail: guettli (*) thomas-guettler + de

--~--~---------~--~----~------------~-------~--~----~
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