[issue10740] sqlite3 module breaks transactions and potentially corrupts data

2016-03-23 Thread Rian Hunter

Changes by Rian Hunter <r...@thelig.ht>:


--
nosy:  -rhunter

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue10740>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9924] sqlite3 SELECT does not BEGIN a transaction, but should according to spec

2016-03-23 Thread Rian Hunter

Rian Hunter added the comment:

This bug can also lead to subtle and unintuitive "database is locked" bugs, 
even when a large timeout is set on the connection. Many, many people are 
affected by this bug (search the web for "python sqlite database is locked"). 
I've attached code that demonstrates this issue.

I disagree that the current behavior cuts down on SQLite file locking. As soon 
as any SELECT statement is opened, an implicit lock is held by SQLite (whether 
it resides within a BEGIN block or not): https://www.sqlite.org/lockingv3.html

SQLite has been designed to do its own "late locking." Pysqlite does not need 
to duplicate this behavior.

This is a clear-as-day bug and should be fixed.

--
nosy: +rhunter
Added file: http://bugs.python.org/file42260/unintuitive_sqlite_behavior.py

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue9924>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9924] sqlite3 SELECT does not BEGIN a transaction, but should according to spec

2016-03-23 Thread Rian Hunter

Changes by Rian Hunter <r...@thelig.ht>:


--
versions: +Python 3.2, Python 3.5, Python 3.6

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue9924>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26625] SELECT-initiated transactions can cause "database is locked" in sqlite

2016-03-23 Thread Rian Hunter

Rian Hunter added the comment:

duplicate of #9924

--
resolution:  -> duplicate
status: open -> closed

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue26625>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26625] SELECT-initiated transactions can cause "database is locked" in sqlite

2016-03-23 Thread Rian Hunter

New submission from Rian Hunter:

When a transaction starts with a SELECT statement this can invoke a "database 
is locked" error if the SELECT statement is not exhausted or explicitly closed.

This can lead to subtle "database is locked" bugs, even when a large timeout is 
set on the connection. Many, many people are affected by this bug (search the 
web for "python sqlite database is locked").

The attached code demonstrates this bug and possible (unintuitive) fixes. The 
best workaround is to "explicitly" start a transaction in these cases by 
issuing a dummy DML statement. This seems very clumsy.

My proposed fix is to implicitly open a transaction before all non-DDL 
statements (including SELECT statements), not just DML statements.

If there won't be a fix soon, then at least the documentation should note this 
quirky behavior.

--
components: Library (Lib)
files: unintuitive_sqlite_behavior.py
messages: 262282
nosy: rhunter
priority: normal
severity: normal
status: open
title: SELECT-initiated transactions can cause "database is locked" in sqlite
type: behavior
versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 3.6
Added file: http://bugs.python.org/file42259/unintuitive_sqlite_behavior.py

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue26625>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10740] sqlite3 module breaks transactions and potentially corrupts data

2016-03-23 Thread Rian Hunter

Rian Hunter added the comment:

@mike Yes you're right, This bug report is different, my mistake.

DB-API may require implicit transactions but pysqlite should open a transaction 
before *any* non-DDL statement, including "SELECT", not just DML statements. 
Currently one must issue a dummy DML statement just to open a transaction that 
otherwise would start with a SELECT statement.

I see nothing in DB-API (https://www.python.org/dev/peps/pep-0249/) that says 
transactions should implicitly open before DML statements and not SELECT 
statements.

--

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue10740>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10740] sqlite3 module breaks transactions and potentially corrupts data

2016-03-23 Thread Rian Hunter

Changes by Rian Hunter <r...@thelig.ht>:


Added file: http://bugs.python.org/file42251/test_sqlite.py

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue10740>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10740] sqlite3 module breaks transactions and potentially corrupts data

2016-03-23 Thread Rian Hunter

Changes by Rian Hunter <r...@thelig.ht>:


Removed file: http://bugs.python.org/file42250/test_sqlite.py

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue10740>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10740] sqlite3 module breaks transactions and potentially corrupts data

2016-03-23 Thread Rian Hunter

Changes by Rian Hunter <r...@thelig.ht>:


Added file: http://bugs.python.org/file42250/test_sqlite.py

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue10740>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10740] sqlite3 module breaks transactions and potentially corrupts data

2016-03-23 Thread Rian Hunter

Changes by Rian Hunter <r...@thelig.ht>:


Removed file: http://bugs.python.org/file42249/test_sqlite.py

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue10740>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10740] sqlite3 module breaks transactions and potentially corrupts data

2016-03-22 Thread Rian Hunter

Rian Hunter added the comment:

Implicit transactions can also cause mysterious "database is locked" bugs, even 
when a large timeout is set on the connection. Many, many people are affected 
by this bug (search the web for "python sqlite database is locked").

The attached code demonstrates this bug and possible (unintuitive) fixes.

If there won't be a fix soon, then at least the documentation should note this 
quirky behavior.

--
nosy: +rhunter
Added file: http://bugs.python.org/file42249/test_sqlite.py

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue10740>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com