Opened 8 years ago

Closed 8 years ago

#4040 defect closed duplicate (duplicate)

Threading error occurs with adbapi and SQLite

Reported by: mjcaley Owned by:
Priority: normal Milestone:
Component: core Keywords:
Cc: Branch:
Author: mjcaley@darkarctic.com

Description

An error occurs from sqlite3 when the reactor is stopped indicating that SQLite objects can only be used in the same thread. Setting the check_same_thread parameter to False in the database connection does suppress this error. Data is returned correctly until up until the reactor is stopped.

I was using revision 26354.

Output:

[(u'admin@…', u'localhost', u'sha256:4672db5a9ff30d9b2d5c97bb9b1d1ea4bdf1262e6a5110b7f43defc4a6ea04db', 1, 1, 0, None, None, None, u'Administrator', None, None, None, u'Example Inc.', None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None), (u'aanderson@…', u'localhost', u'sha256:500c7694095af2f2e5b38b4d54b1b013e030c2ddb45510099d015bfcb5c35849', 1, 1, 0, u'Alice', None, u'Anderson', u'Alice Anderson', u'AA', u'CEO', u'Executive', u'Example Inc.', None, None, u'123 Here Ave.', u'Apt. 123', u'Appletown', u'A0A 0A0', u'Canada', None, None, None, None, None, None, u'(111) 111-1111', u'(222) 222-2222 x2222', None, None, None, None, None, None, None)] Traceback (most recent call last):

File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Twisted-8.2.0_r27354-py2.6-macosx-10.3-i386.egg/twisted/internet/defer.py", line 181, in addCallbacks

self._runCallbacks()

File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Twisted-8.2.0_r27354-py2.6-macosx-10.3-i386.egg/twisted/internet/defer.py", line 323, in _runCallbacks

self.result = callback(self.result, *args, kw)

File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Twisted-8.2.0_r27354-py2.6-macosx-10.3-i386.egg/twisted/internet/base.py", line 410, in _continueFiring

callable(*args, kwargs)

File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Twisted-8.2.0_r27354-py2.6-macosx-10.3-i386.egg/twisted/enterprise/adbapi.py", line 374, in finalClose

self._close(conn)

--- <exception caught here> ---

File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/Twisted-8.2.0_r27354-py2.6-macosx-10.3-i386.egg/twisted/enterprise/adbapi.py", line 420, in _close

conn.close()

sqlite3.ProgrammingError: SQLite objects created in a thread can only be used in that same thread.The object was created in thread id -1341648896 and this is thread id -1610029280

Attachments (1)

dirserv.py (411 bytes) - added by mjcaley 8 years ago.
Source

Download all attachments as: .zip

Change History (3)

Changed 8 years ago by mjcaley

Attachment: dirserv.py added

Source

comment:1 Changed 8 years ago by Jean-Paul Calderone

Resolution: duplicate
Status: newclosed

Duplicate of #3629.

comment:2 Changed 7 years ago by <automation>

Owner: Glyph deleted
Note: See TracTickets for help on using tickets.