Daniele Varrazzo | 25 Jul 2010 02:43
Picon
Gravatar

Re: Psycopg 2.2.x issue with PgBouncer

On Sat, Jul 24, 2010 at 3:18 PM, Jan UrbaƄski <wulczer <at> wulczer.org> wrote:

> I fixed it in two ways. First, the code keeps a flag that tells if
> deallocation is underway. If the flag is set, the deallocation function
> is a noop (this prevents recursive invocation).
>
> Second, if deallocation is underway, the green execution method is never
> used (it always blocks). That's not ideal, but otherwise it would mean
> calling the user-defined callback with the connection object as an
> argument that has zero refs... Not sure how this could be fixed.
>
> Note that with the second fix the first is not needed, as we bypass
> green execution mode and so won't trigger recursive dealloc. I still
> think it's useful to have a guard there, in case later on we start doing
> someting in the connection_dealloc function that will cause similar issues.

Thank you for these patches. I think not dropping into the wait
callback is compulsory when the refcount of the connection is zero.
This leads to the only solution of issuing the final rollback in
blocking mode. I think it's perfectly fine, as people can always issue
a manual close before gc-ing the connection. I would add a note about
that in the documentation.

-- Daniele
_______________________________________________
Psycopg mailing list
Psycopg <at> lists.initd.org
http://lists.initd.org/mailman/listinfo/psycopg

Gmane