Re: [sqlalchemy] Understanding sporadic ObjectDeletedError (in gevent)

2017-06-30 Thread Mike Bayer
On Fri, Jun 30, 2017 at 3:48 PM, Anders Steinlein wrote: > I see, and that makes sense. However, wouldn't that be true in regular > threaded environments as well? Any idea why this is manifesting itself after > we switched to gevent? Simply the fact that we're now more likely to get a > different

Re: [sqlalchemy] Understanding sporadic ObjectDeletedError (in gevent)

2017-06-30 Thread Anders Steinlein
On Fri, Jun 30, 2017 at 8:04 PM, Mike Bayer wrote: > On Fri, Jun 30, 2017 at 11:52 AM, Anders Steinlein wrote: > > [...] > > > > > I've set _use_threadlocal = True on the connection pool, as my thinking > > initially was that we could be getting a different connection object back > > from the po

Re: [sqlalchemy] Understanding sporadic ObjectDeletedError (in gevent)

2017-06-30 Thread Mike Bayer
On Fri, Jun 30, 2017 at 11:52 AM, Anders Steinlein wrote: > After this switch, we're seeing sporadic ObjectDeletedError exceptions > illustrated by the following simple lines of code: > > @newsletters.route('/create/', methods=['GET', 'POST']) > @login_required > def create(): > newslett

[sqlalchemy] Understanding sporadic ObjectDeletedError (in gevent)

2017-06-30 Thread Anders Steinlein
Hi, We're using SQLAlchemy (see below for versions) on Flask running on uWSGI in gevent mode, with psycopg2 to PostgreSQL 9.4. We recently switched from regular prefork+threaded to gevent mode, and with it applied all gevent monkey patches and the psycogreen package for the psycopg2 gevent wait ca