Strange occasional ProgrammingError: Cannot operate on a closed database

233 views
Skip to first unread message

Roy H. Han

unread,
Apr 21, 2011, 11:36:23 PM4/21/11
to sqlalchemy
Lately, I've been getting the following error quite randomly while
developing a web app using sqlite3. I'm not sure how to fix it and it
hasn't to me before, but it is leading to occasional failed AJAX
requests.

ProgrammingError: (ProgrammingError) Cannot operate on a closed
database. None [{}]

Does anyone else have a similar issue or know how I can avoid it?

RHH

Kent Hsu

unread,
Apr 25, 2011, 5:05:22 AM4/25/11
to sqlalchemy
I got the same error. My web applicaiton works fine with sa0.5, but
does not work since sa0.6.

The situation is much like the follow link.

https://github.com/Pylons/pyramid/issues/174

Best Regards,
Kent Hsu

On 4月22日, 上午11時36分, "Roy H. Han" <starsareblueandfara...@gmail.com>
wrote:

Michael Bayer

unread,
Apr 25, 2011, 10:12:18 AM4/25/11
to sqlal...@googlegroups.com
the "refresh 50 times" aspect suggests it's concurrency-related. SingletonThreadpool, the pool the SQLite dialect uses in 0.6, isn't the best choice for a file-based database so I'd recommend switching to NullPool which is the default in 0.7.

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

Kent Hsu

unread,
Apr 26, 2011, 5:00:16 AM4/26/11
to sqlalchemy
Thanks. It works after switching to NullPool.
Reply all
Reply to author
Forward
0 new messages