[issue8689] sqlite3 parameter substitution breaks with multiple parameters
New submission from Simon Jagoe : I have been using sqlalchemy and sqlamp in a project for a while with Python 2.5.x and Python 2.6.4. With a recent upgrade to Python 2.6.5 (on Ubuntu Lucid Lynx), a particular operation began to fail when using sqlite. I have tracked this to using the sqlite3 module and multiple parameter substitution. See below for a simple test case. Set up the database: >>> import sqlite3 >>> conn = sqlite3.connect('test.sqlite3') >>> c = conn.cursor() >>> c.execute('create table test (col integer)') >>> c.execute('insert into test values (1)') >>> conn.commit() Actual result: >>> c.execute('SELECT coalesce(max(test.col), ?) + ? AS col FROM test', (0, 1)) >>> c.fetchone() (None,) Expected result: >>> c.execute('SELECT coalesce(max(test.col), ?) + ? AS col FROM test', (0, 1)) >>> c.fetchone() (2,) The expected result can be simulated like this: >>> c.execute('SELECT coalesce(max(test.col), 0) + 1 AS col FROM test') >>> c.fetchone() (2,) -- messages: 105525 nosy: azriphale priority: normal severity: normal status: open title: sqlite3 parameter substitution breaks with multiple parameters versions: Python 2.6 ___ Python tracker <http://bugs.python.org/issue8689> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21009] Potential deadlock in concurrent futures when garbage collection occurs during Queue.get
Simon Jagoe added the comment: In the script attached to the original issue, the weakref callback that causes the hang is the callback defined in ThreadPoolExecutor._adjust_thread_count Attached is a faulthandler stack captured from Python 3.6.1. The script submitted here uses a patched queue.get() method to force garbage collection to reliably trigger the issue, but this deadlock was observed in a real application using threadpool executors. -- Added file: https://bugs.python.org/file47132/executor-hang-faulthandler.txt ___ Python tracker <https://bugs.python.org/issue21009> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21009] Potential deadlock in concurrent futures when garbage collection occurs during Queue.get
New submission from Simon Jagoe: At Enthought we have been tracking a deadlock in some code that turned out to be due to the following scenario: 0) There is some cyclic garbage that requires collection; an object in the garbage is referred to by a weakref with a callback 1) You have a lock that is acquired 2) While the lock is held, the garbage collector runs (on the same thread) 3) The weakref callback in (0) is called via the garbage collecter and the callback tries to acquire the same lock that was acquired in (1) Attached is a simple script that exercises the issue in Python 3.3. The script monkey-patches Queue.get to force garbage collection after acquiring the Queue.not_empty lock. -- components: Library (Lib) files: executor-hang.py messages: 214380 nosy: simon.jagoe priority: normal severity: normal status: open title: Potential deadlock in concurrent futures when garbage collection occurs during Queue.get type: behavior versions: Python 3.3, Python 3.4 Added file: http://bugs.python.org/file34551/executor-hang.py ___ Python tracker <http://bugs.python.org/issue21009> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8689] sqlite3 parameter substitution breaks with multiple parameters
Simon Jagoe added the comment: I will try to test this with the different combinations of python and sqlite versions. -- ___ Python tracker <http://bugs.python.org/issue8689> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8689] sqlite3 parameter substitution breaks with multiple parameters
Simon Jagoe added the comment: Sorry for the waste of time. I have compiled Python 2.6.5 against sqlite3 3.6.22 (Lucid version) and 3.6.16-1ubuntu1 (Karmic version). The test I posted originally fails with sqlite3 3.6.22 and passes with sqlite3 3.6.16-1ubuntu1, so it would appear to be a change in the library that is causing this error. -- ___ Python tracker <http://bugs.python.org/issue8689> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com