twisted / twisted

Event-driven networking engine written in Python.
https://www.twisted.org
Other
5.44k stars 1.14k forks source link

Threading error occurs with adbapi and SQLite #4040

Closed twisted-trac closed 14 years ago

twisted-trac commented 14 years ago
mjcaley's avatar mjcaley reported
Trac ID trac#4040
Type defect
Created 2009-09-25 00:56:58Z

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@example.net', 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@example.net', 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) --- --- 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:

Searchable metadata ``` trac-id__4040 4040 type__defect defect reporter__mjcaley mjcaley priority__normal normal milestone__ branch__ branch_author__ status__closed closed resolution__duplicate duplicate component__core core keywords__ time__1253840218000000 1253840218000000 changetime__1253843757000000 1253843757000000 version__None None owner__ ```
twisted-trac commented 13 years ago
Automation's avatar Automation removed owner
twisted-trac commented 14 years ago
exarkun's avatar @exarkun set status to closed

Duplicate of #3629.