Bugs item #1592786, was opened at 2006-11-08 17:20
Message generated for change (Comment added) made by jayhem
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=540672&aid=1592786&group_id=74338
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: SQLite
Group: None
Status: Open
Resolution: Invalid
Priority: 5
Private: No
Submitted By: Jayhem (jayhem)
Assigned to: Nobody/Anonymous (nobody)
Summary: so-sqlite data corruption during updates
Initial Comment:
I'm hitting a bug when using SO with turbogears 1.1b
with an sqlite database. When I do several successive
updates to a table (which are very slow btw), data gets
corrupted in the interface, select() returns invalid
objects, as if objects were pulled from a cache that
was out of synch with the db.
>From this point, successive select() without any
updates in-between can return different values,
randomly selecting one of the previsouly set values.
I have created a simple test-case (on turbogears)
Just launch it and change some values. Usually after
10-20 changes, the corruption appears.
I have tried this same testcase with MySQL and do not
hit this problem.
Note that dev.cfg declares
sqlobject.dburi="notrans_sqlite:///..."
file: model.py
======================================================
from sqlobject import *
from turbogears.database import PackageHub
hub = PackageHub("bug")
__connection__ = hub
class Item(SQLObject):
data = UnicodeCol(length=40)
def loaddb():
hub.begin()
Item.dropTable(ifExists=True, cascade=True)
hub.commit()
Item.createTable(ifNotExists=True)
for i in range(20):
Item(data = str(i))
hub.commit()
loaddb()
file: controllers.py
======================================================
import turbogears
from turbogears.controllers import RootController, expose
from model import Item
class Root(RootController):
@expose(template="bug.templates.index")
def index(self):
items = Item.select()
return dict(items = items)
@expose(template="bug.templates.index")
def change(self, id):
item = Item.get(id)
item.data += str(id)
items = Item.select()
return dict(items = items)
file: index.kid
======================================================
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:py="http://purl.org/kid/ns#"
py:extends="'master.kid'">
<head>
<meta content="text/html; charset=UTF-8"
http-equiv="content-type"
py:replace="''"/>
<title>Items</title>
</head>
<body>
<ul py:for="i in items">
<li>${i.data} <a
href="/change/${i.id}">[edit]</a></li>
</ul>
</body>
</html>
----------------------------------------------------------------------
>Comment By: Jayhem (jayhem)
Date: 2006-11-14 12:04
Message:
Logged In: YES
user_id=1640652
You are right. the bug does not seem to cause data
corruption in the database (i.e it's not a db related
issue), it just causes random results to be returned from
queries.
Simply switching the database to MySQL solves the problem,
which confirms the bug is not in the db.
An even more annoying issue, which I think is related, is
the extremely slow inserts/updates into sqlite, and frequent
error messages telling me the db is locked.
I am new to turbogears, sqlobject, sqlite and python, so I'm
sorry I won't have time to work on a SqlObject-only
testcase. Let me know if I can do anything to help fix this.
----------------------------------------------------------------------
Comment By: Oleg Broytmann (phd)
Date: 2006-11-13 16:59
Message:
Logged In: YES
user_id=4799
Our company has been using SQLObject with SQLite for three
rather large commercial programs. Neither of our developers,
testers or users ever experienced data loss. Are you sure
the problem is not TG-related? Please write an
SQLObject-only test. In any case I cannot run your program -
I don't have TG and not going to install it.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=540672&aid=1592786&group_id=74338
|