Skip to content

repeated database locked (Operational Error) issues in high activity, db intensive application. #280

@steelliberty

Description

@steelliberty

Dear Sir :

I am using pony 0.7.1 with PyPy 5.6.0 and sqlite3 in an application that monitors hundreds of sites for being up using ping and http, tcp pings. Status records are generated every second of an hour logging information about the current 'ping.' I have on a frequent basis, an error as shown below.

I have felt comfortable with sqlite3 until recent increases in this error give me concern as to whether there is a better way to operate on a Status record ( I have added the volatility flag to the DB ) or if their is a typical way to wait and try again ( I do try again but always with the same exception) . I understand that poor programming can explain many issues with database access, but I have studied comments from various sources about this situation and I do not see where I am improperly attempting this operation.

I am reluctant to move away from sqlite3 because it is otherwise stable -- hoping to avoid a new collection of issues dealing with another db such as MySQL ..

File "scan_notify.py", line 669, in run
self.checkDownMonitors()
File "<auto generated wrapper of checkDownMonitors() function>", line 2, in checkDownMonitors
File "/tombstone/site-packages/pony/orm/core.py", line 413, in new_func
try: return func(*args, **kwargs)
File "scan_notify.py", line 357, in checkDownMonitors
mainCheck()
File "<auto generated wrapper of mainCheck() function>", line 2, in mainCheck
File "/tombstone/site-packages/pony/orm/core.py", line 413, in new_func
try: return func(*args, **kwargs)
File "scan_notify.py", line 156, in mainCheck
ss = Status.get_for_update(id=newsitesdowndict[nsdhost].id)
File "<auto generated wrapper of get_for_update() function>", line 2, in get_for_update
File "/tombstone/site-packages/pony/utils/utils.py", line 58, in cut_traceback
return func(*args, **kwargs)
File "/tombstone/site-packages/pony/orm/core.py", line 3586, in get_for_update
try: return entity.find_one(kwargs, True, nowait) # can throw MultipleObjectsFoundError
File "/tombstone/site-packages/pony/orm/core.py", line 3670, in find_one
if obj is None: obj = entity.find_in_db(avdict, unique, for_update, nowait)
File "/tombstone/site-packages/pony/orm/core.py", line 3729, in find_in_db
cursor = database._exec_sql(sql, arguments)
File "/tombstone/site-packages/pony/orm/core.py", line 696, in _exec_sql
connection = cache.prepare_connection_for_query_execution()
File "/tombstone/site-packages/pony/orm/core.py", line 1536, in prepare_connection_for_query_execution
except Exception as e: connection = cache.reconnect(e)
File "/tombstone/site-packages/pony/orm/core.py", line 1511, in reconnect
if not provider.should_reconnect(exc): reraise(*sys.exc_info())
File "/tombstone/site-packages/pony/orm/core.py", line 1535, in prepare_connection_for_query_execution
try: provider.set_transaction_mode(connection, cache) # can set cache.in_transaction
File "<auto generated wrapper of set_transaction_mode() function>", line 2, in set_transaction_mode
File "/tombstone/site-packages/pony/orm/dbapiprovider.py", line 53, in wrap_dbapi_exceptions
except dbapi_module.OperationalError as e: raise OperationalError(e)
OperationalError: database is locked

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions