uh yeah you totally nailed that one, QueuePool and SingletonThreadPool had 
similar issues.      I think in Jython those connections would eventually be 
closed when asynchronous gc collects them, but we definitely don't ever want to 
rely on gc to close connections we're discarding.

This issue is fixed in 0.6.7 and 0.7.0 in aff95843c12f / ee4e79274f1f for both 
pools.

you can get at these from hg via:

http://hg.sqlalchemy.org/sqlalchemy/archive/default.tar.gz
http://hg.sqlalchemy.org/sqlalchemy/archive/rel_0_6.tar.gz


On Mar 22, 2011, at 10:10 PM, Jaimy Azle wrote:

> Dear All,
> 
> I am using SQLAlchemy with Jython, I found there is a different
> SQLAlchemy behaviour between CPython and Jython. In Jython, discarded
> overflow connection object does not automatically close the actual
> database socket connection during gc, anybody could confirm this?
> 
> my temporary, simple workaround was to explicitly close those overflow
> connection before discard it in sqlalchemy.pool.QueuePool.
> 
>    def do_return_conn(self, conn):
>        try:
>            self._pool.put(conn, False)
>        except sqla_queue.Full:
>            if self._overflow_lock is None:
>                self._overflow -= 1
>>>             conn.close()
>            else:
>                self._overflow_lock.acquire()
>                try:
>                    self._overflow -= 1
>>>                 conn.close()
>                finally:
>                    self._overflow_lock.release()
> 
> 
> -- 
> Salam,
> 
> -Jaimy Azle
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "sqlalchemy" group.
> To post to this group, send email to sqlalchemy@googlegroups.com.
> To unsubscribe from this group, send email to 
> sqlalchemy+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/sqlalchemy?hl=en.
> 

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to