#13870: psycopg2 backend never terminates isolating transactions
---------------------------------------------------+------------------------
          Reporter:  patrys                        |         Owner:  nobody
            Status:  new                           |     Milestone:        
         Component:  Database layer (models, ORM)  |       Version:  1.2   
        Resolution:                                |      Keywords:        
             Stage:  Unreviewed                    |     Has_patch:  1     
        Needs_docs:  0                             |   Needs_tests:  0     
Needs_better_patch:  0                             |  
---------------------------------------------------+------------------------
Comment (by lerouxb):

 I have had the same problem on Django 1.2. I just applied this patch and
 will report back on my progress.

 In the past I have partially worked around this problem by manually
 calling connection.close(). I noticed that when I write custom command-
 line scripts that use my models via Django's ORM, then I have to close
 connections manually. I assume the transaction middleware doesn't execute
 (and therefore close the connection) in that sort of environment, but for
 some reason it still opens transactions.

 The easiest way to notice when things go wrong is, well, every time I try
 to alter a table during development: The connection just hangs forever.
 The only way I found to work around it is to restart the postgresql
 process. (I can't find an easy way to break these locks from the command-
 line psql client or make them expire.)

 It also looks like the transaction middleware code that's supposed to roll
 back transactions or close the connection is not guaranteed to execute,
 but I haven't looked very deeply into it. What happens when your code
 encounters errors and you get an unhandled exception?

 Another possible workaround would be to somehow make all locks expire
 after a short period of time, but I can't find how to do that. Or to close
 connections from the postgresql server end after a short period of
 inactivity. Again, not even sure if that's possible. Or perhaps if it was
 possible to only enter a transaction if you perform an update query? Then
 at least this wouldn't happen quite so often.

 But something is certainly wrong.

 Another option would be to just steer clear of automatic transactions.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/13870#comment:2>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to