openvstorage / alba-asdmanager

The ALBA ASD manager is a lightweight library which turns devices into disks which are addressable as key/value disk over an IP and port.
Other
1 stars 3 forks source link

Database is locked exception #327

Open JeffreyDevloo opened 6 years ago

JeffreyDevloo commented 6 years ago

Problem description

Certain calls give of OperationalError: database is locked. Looks like certain paths are not occurring in a locked context

Examples;

Apr 24 05:06:34 R25U13 python[172409]: 2018-04-24 05:06:34 13900 -0600 - R25U13 - 172409/140639893485312 - flask/decorators.py - new_function - 21365 - ERROR - Unexpected exception
Apr 24 05:06:34 R25U13 python[172409]: Traceback (most recent call last):
Apr 24 05:06:34 R25U13 python[172409]:   File "/usr/lib/python2.7/dist-packages/ovs_extensions/api/decorators.py", line 111, in new_function
Apr 24 05:06:34 R25U13 python[172409]:     return_data = f(*args, **kwargs)
Apr 24 05:06:34 R25U13 python[172409]:   File "/opt/asd-manager/source/app/api.py", line 125, in get_slots
Apr 24 05:06:34 R25U13 python[172409]:     stack[slot_id].update({'osds': dict((asd.asd_id, asd.export()) for asd in disk.asds)})
Apr 24 05:06:34 R25U13 python[172409]:   File "/usr/lib/python2.7/dist-packages/ovs_extensions/dal/base.py", line 104, in <lambda>
Apr 24 05:06:34 R25U13 python[172409]:     setattr(self.__class__, key, property(lambda s: s._get_foreign_relation(relation_info)))
Apr 24 05:06:34 R25U13 python[172409]:   File "/usr/lib/python2.7/dist-packages/ovs_extensions/dal/base.py", line 109, in _get_foreign_relation
Apr 24 05:06:34 R25U13 python[172409]:     remote_class._ensure_table()
Apr 24 05:06:34 R25U13 python[172409]:   File "/usr/lib/python2.7/dist-packages/ovs_extensions/dal/base.py", line 224, in _ensure_table
Apr 24 05:06:34 R25U13 python[172409]:     connection.execute('CREATE TABLE IF NOT EXISTS {0} ({1})'.format(cls._table, ', '.join(primary_key + properties + relations)))
Apr 24 05:06:34 R25U13 python[172409]: OperationalError: database is locked
Apr 24 04:30:39 R25U13 python[172409]: 2018-04-24 04:30:39 35100 -0600 - R25U13 - 172409/140639893485312 - flask/decorators.py - new_function - 18013 - ERROR - Unexpected exception
Apr 24 04:30:39 R25U13 python[172409]: Traceback (most recent call last):
Apr 24 04:30:39 R25U13 python[172409]:   File "/usr/lib/python2.7/dist-packages/ovs_extensions/api/decorators.py", line 111, in new_function
Apr 24 04:30:39 R25U13 python[172409]:     return_data = f(*args, **kwargs)
Apr 24 04:30:39 R25U13 python[172409]:   File "/opt/asd-manager/source/app/api.py", line 124, in get_slots
Apr 24 04:30:39 R25U13 python[172409]:     stack[slot_id] = disk.export()
Apr 24 04:30:39 R25U13 python[172409]:   File "/opt/asd-manager/source/dal/objects/disk.py", line 122, in export
Apr 24 04:30:39 R25U13 python[172409]:     'state_detail': self.status.get('detail', ''),
Apr 24 04:30:39 R25U13 python[172409]:   File "/usr/lib/python2.7/dist-packages/ovs_extensions/dal/base.py", line 100, in <lambda>
Apr 24 04:30:39 R25U13 python[172409]:     setattr(self.__class__, key, property(lambda s: getattr(s, '_{0}'.format(key))()))
Apr 24 04:30:39 R25U13 python[172409]:   File "/opt/asd-manager/source/dal/objects/disk.py", line 87, in _status
Apr 24 04:30:39 R25U13 python[172409]:     if len(self.asds) == 0:
Apr 24 04:30:39 R25U13 python[172409]:   File "/usr/lib/python2.7/dist-packages/ovs_extensions/dal/base.py", line 104, in <lambda>
Apr 24 04:30:39 R25U13 python[172409]:     setattr(self.__class__, key, property(lambda s: s._get_foreign_relation(relation_info)))
Apr 24 04:30:39 R25U13 python[172409]:   File "/usr/lib/python2.7/dist-packages/ovs_extensions/dal/base.py", line 114, in _get_foreign_relation
Apr 24 04:30:39 R25U13 python[172409]:     [self.id])
Apr 24 04:30:39 R25U13 python[172409]: OperationalError: database is locked
sjovdnbos commented 5 years ago

Fixed by:

https://github.com/openvstorage/framework-extensions/pull/202 openvstorage-extensions-0.5.3-dev.1547742527.a544f36